1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix various points reported by cppcheck (#5656)

* Fix various performance issues reported by cppcheck + code style (CI)

* Make CI happy with code style on master
* guiFileSelectMenu: remove useless includes
* some performance fixes pointed by cppcheck
* remove some useless casts
* TextDest: remove unused setFormSpec function

* Fix various iterator post-increment reported by cppcheck
This commit is contained in:
Loïc Blot 2017-04-25 10:17:53 +02:00 committed by Loïc Blot
parent af96309621
commit a7e131f53e
13 changed files with 29 additions and 31 deletions

View file

@ -46,26 +46,26 @@ AsyncEngine::~AsyncEngine()
// Request all threads to stop
for (std::vector<AsyncWorkerThread *>::iterator it = workerThreads.begin();
it != workerThreads.end(); it++) {
it != workerThreads.end(); ++it) {
(*it)->stop();
}
// Wake up all threads
for (std::vector<AsyncWorkerThread *>::iterator it = workerThreads.begin();
it != workerThreads.end(); it++) {
it != workerThreads.end(); ++it) {
jobQueueCounter.post();
}
// Wait for threads to finish
for (std::vector<AsyncWorkerThread *>::iterator it = workerThreads.begin();
it != workerThreads.end(); it++) {
it != workerThreads.end(); ++it) {
(*it)->wait();
}
// Force kill all threads
for (std::vector<AsyncWorkerThread *>::iterator it = workerThreads.begin();
it != workerThreads.end(); it++) {
it != workerThreads.end(); ++it) {
delete *it;
}
@ -205,7 +205,7 @@ void AsyncEngine::pushFinishedJobs(lua_State* L) {
void AsyncEngine::prepareEnvironment(lua_State* L, int top)
{
for (UNORDERED_MAP<std::string, lua_CFunction>::iterator it = functionList.begin();
it != functionList.end(); it++) {
it != functionList.end(); ++it) {
lua_pushstring(L, it->first.c_str());
lua_pushcfunction(L, it->second);
lua_settable(L, top);

View file

@ -263,7 +263,7 @@ void ScriptApiNode::node_on_receive_fields(v3s16 p,
lua_pushstring(L, formname.c_str()); // formname
lua_newtable(L); // fields
StringMap::const_iterator it;
for (it = fields.begin(); it != fields.end(); it++) {
for (it = fields.begin(); it != fields.end(); ++it) {
const std::string &name = it->first;
const std::string &value = it->second;
lua_pushstring(L, name.c_str());