Improve the code by static code analysis [2/3]: Performanceamule-svn-r10783
commite92c9e810d973e4a1e0a44674ac6754e439094c9
authorupstream svn <svn@amule.org>
Fri, 11 May 2012 18:38:43 +0000 (11 18:38 +0000)
committerDévai Tamás <gonosztopi@amule.org>
Fri, 11 May 2012 20:08:53 +0000 (11 20:08 +0000)
tree6de7544eac9694aba8cf34075812937517ad56c5
parent6ee694c0309d017ebcd10979a429de96277f783d
Improve the code by static code analysis [2/3]: Performance

Using the results cppcheck gave on the aMule source tree, the following fixes
and improvements were made:

- Use empty() for STL container emptyness checking. size() can take linear time
  while empty() is guaranteed to take constant time.
- Use prefix increment/decrement for non-primitive types (such as STL container
  iterators). A postfix operator usually needs a little extra code and
  housekeeping to keep the old value around.
- Remove unused variables. This includes variables that are assigned a value
  which is later never read.
- Pass non-POD type arguments by const reference instead of value.
- Catch by const reference instead of value.
64 files changed:
.svn-revision
src/ClientCredits.h
src/ClientList.cpp
src/DirectoryTreeCtrl.cpp
src/DownloadClient.cpp
src/DownloadListCtrl.cpp
src/DownloadQueue.cpp
src/ECSpecialCoreTags.cpp
src/ECSpecialMuleTags.cpp
src/ExternalConn.cpp
src/ExternalConn.h
src/GapList.cpp
src/GenericClientListCtrl.cpp
src/HTTPDownload.cpp
src/KnownFile.cpp
src/KnownFileList.cpp
src/LibSocketAsio.cpp
src/ListenSocket.cpp
src/MuleCollection.cpp
src/MuleListCtrl.cpp
src/ObservableQueue.h
src/PartFileConvert.cpp
src/RangeMap.h
src/SHAHashSet.cpp
src/SafeFile.cpp
src/SearchFile.cpp
src/SearchList.cpp
src/Server.cpp
src/Server.h
src/ServerConnect.h
src/ServerList.cpp
src/ServerSocket.cpp
src/ServerUDPSocket.cpp
src/StatTree.cpp
src/Statistics.cpp
src/TextClient.cpp
src/TextClient.h
src/UPnPBase.cpp
src/UploadQueue.cpp
src/amule-remote-gui.cpp
src/amule-remote-gui.h
src/amule.cpp
src/amule.h
src/amuled.cpp
src/kademlia/kademlia/Entry.cpp
src/kademlia/kademlia/Indexed.cpp
src/kademlia/routing/RoutingBin.cpp
src/kademlia/routing/RoutingZone.cpp
src/libs/ec/cpp/ECSocket.cpp
src/libs/ec/cpp/ECSpecialTags.cpp
src/libs/ec/cpp/ECTag.cpp
src/libs/ec/cpp/RemoteConnect.h
src/updownclient.h
src/utils/fileview/FileView.cpp
src/utils/plasmamule/plasma-applet-plasmamule.cpp
src/utils/plasmamule/plasma-engine-plasmamule.cpp
src/utils/plasmamule/plasmamule-engine-feeder.cpp
src/utils/plasmamule/qt-emc.cpp
src/webserver/src/WebServer.cpp
src/webserver/src/WebServer.h
src/webserver/src/php_amule_lib.cpp
src/webserver/src/php_core_lib.cpp
src/webserver/src/php_syntree.cpp
unittests/tests/CTagTest.cpp