[Commits] [wesnoth/wesnoth] 36e929: pass const struct by ref instead of by value
GitHub
noreply at github.com
Sun Jan 28 15:10:15 UTC 2018
Branch: refs/heads/master
Home: https://github.com/wesnoth/wesnoth
Commit: 36e92900c374b801df133b7221a04014b3b20b84
https://github.com/wesnoth/wesnoth/commit/36e92900c374b801df133b7221a04014b3b20b84
Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
Date: 2018-01-28 (Sun, 28 Jan 2018)
Changed paths:
M src/server/game.cpp
M src/server/game.hpp
Log Message:
-----------
pass const struct by ref instead of by value
cppcheck (via Codacy) reports the lowest-quality C++ is src/sever/game.hpp with 41 warnings.
There is no need to copy the const socket_ptr struct all over place to pass-by-value. It's const, so we can pass-by-reference and save time and memory.
Commit: 5e0c3056dc0f0cf76fd9b6dd77a83f1c0de2a9dc
https://github.com/wesnoth/wesnoth/commit/5e0c3056dc0f0cf76fd9b6dd77a83f1c0de2a9dc
Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
Date: 2018-01-28 (Sun, 28 Jan 2018)
Changed paths:
M src/gui/core/canvas.cpp
Log Message:
-----------
clarify resize and stretch logic
cppcheck (via Codacy) rightly noted that the construct ((!!w ^ !!h)) was confusing.
Rearrange the code a bit, note some things must be true without testing them, and we can eliminate two variables, make the code faster than the "cute optimization" and make it FAR easier to read.
Commit: e12a2a19ca385f6708c617cb5ab66ac0b1479391
https://github.com/wesnoth/wesnoth/commit/e12a2a19ca385f6708c617cb5ab66ac0b1479391
Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
Date: 2018-01-28 (Sun, 28 Jan 2018)
Changed paths:
M src/build_info.cpp
Log Message:
-----------
fix reassign before first use
cppcheck (via Codacy) pointed out that a variable was initialized, then reassigned, before the initialed value was used.
Moved the variable declaration to the point the actually-used value was assigned.
Commit: 2e1dbfc235334117c61c7a4bbb4ff1d1f76e2a2d
https://github.com/wesnoth/wesnoth/commit/2e1dbfc235334117c61c7a4bbb4ff1d1f76e2a2d
Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
Date: 2018-01-28 (Sun, 28 Jan 2018)
Changed paths:
M src/gui/dialogs/gamestate_inspector.cpp
Log Message:
-----------
cppcheck is confused by an initializer list
Commit: 84194f76efa7d00c4b671791dd792f3307927173
https://github.com/wesnoth/wesnoth/commit/84194f76efa7d00c4b671791dd792f3307927173
Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
Date: 2018-01-28 (Sun, 28 Jan 2018)
Changed paths:
M src/config_cache.cpp
Log Message:
-----------
perform initialization in the initializer
cppcheck (via Codacy) pointed out it's sorta silly to default initialize then immediately assign a non-default value.
Commit: 45d101e8caa54905ccd15173e1d3bbf75b21518a
https://github.com/wesnoth/wesnoth/commit/45d101e8caa54905ccd15173e1d3bbf75b21518a
Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
Date: 2018-01-28 (Sun, 28 Jan 2018)
Changed paths:
M src/gui/auxiliary/old_markup.hpp
Log Message:
-----------
variable not assigned in operator=
cppcheck (via Codacy) points out that one member vairable was not assigned.
Commit: 59554ca0cda7d0c2dfabf1271f0c7b25a876e2d7
https://github.com/wesnoth/wesnoth/commit/59554ca0cda7d0c2dfabf1271f0c7b25a876e2d7
Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
Date: 2018-01-28 (Sun, 28 Jan 2018)
Changed paths:
M src/tests/gui/test_gui2.cpp
Log Message:
-----------
cppcheck has a problem
cppcheck (via Codacy) had a problem with the form `T & T` so used `auto & T`
This is probably a bug in cppcheck but reported to Codacy in case it's their fault since the message form was for && and this was just &.
Commit: b74df558e05712fb014708775b42b476fe115473
https://github.com/wesnoth/wesnoth/commit/b74df558e05712fb014708775b42b476fe115473
Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
Date: 2018-01-28 (Sun, 28 Jan 2018)
Changed paths:
M src/addon/validation.cpp
Log Message:
-----------
clearly check itor at end
cppcheck (via Codacy) notes that it's not clear that the iterator (j) cannot exceed end() because most don't expect pointer math.
Rewrote to make it more clear what is going on.
Commit: 45eae14999769cfd604292fe67efd0f4c2078fb0
https://github.com/wesnoth/wesnoth/commit/45eae14999769cfd604292fe67efd0f4c2078fb0
Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
Date: 2018-01-28 (Sun, 28 Jan 2018)
Changed paths:
M src/editor/map/map_context.cpp
M src/formula/formula.cpp
Log Message:
-----------
fix poor rethrows
cppcheck (via Codacy) points out that it is better to rethrow the current event than to throw a new copy of it.
Commit: 8f22144e8ed1b1eacb74183a73af70e884873c3a
https://github.com/wesnoth/wesnoth/commit/8f22144e8ed1b1eacb74183a73af70e884873c3a
Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
Date: 2018-01-28 (Sun, 28 Jan 2018)
Changed paths:
M src/gui/dialogs/statistics_dialog.cpp
Log Message:
-----------
clarify ^ vs ?:
cppcheck (via Codacy) points out the operator precidence is unclearn. Added parentheses to fix that.
Commit: c0689b792462b1c6737b63c221d0a349e9e7003d
https://github.com/wesnoth/wesnoth/commit/c0689b792462b1c6737b63c221d0a349e9e7003d
Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
Date: 2018-01-28 (Sun, 28 Jan 2018)
Changed paths:
M src/units/filter.cpp
M src/utils/name_generator_factory.cpp
M src/whiteboard/highlighter.cpp
M src/whiteboard/utility.cpp
Log Message:
-----------
prefer prefix ++
cppcheck (via Codacy) points out it's better to use prefix ++ on iterators in a for statement.
Compare: https://github.com/wesnoth/wesnoth/compare/99051100a4d4...c0689b792462
More information about the Commits
mailing list