Details
-
Bug
-
Status: Closed
-
Trivial
-
Resolution: Fixed
-
0.9.2
-
None
Description
These are performance-related issues identified by cppcheck that could be cleaned up. Since these are not logic errors per se, I have marked them as trivial:
grep 'performance' /tmp/cppcheck-thrift.issues [compiler/cpp/src/parse/t_enum.h:47]: (performance) Function parameter 'name' should be passed by reference. [compiler/cpp/src/parse/t_program.h:72]: (performance) Variable 'name_' is assigned in constructor body. Consider performing initialization in initialization list. [compiler/cpp/src/parse/t_service.h:48]: (performance) Prefer prefix ++/-- operators for non-primitive types. [contrib/fb303/TClientInfo.cpp:157] -> [contrib/fb303/TClientInfo.cpp:159]: (performance) Variable 'secs' is reassigned a value before the old one has been used. [contrib/fb303/cpp/FacebookBase.cpp:101]: (performance) Prefer prefix ++/-- operators for non-primitive types. [contrib/fb303/cpp/ServiceTracker.cpp:254]: (performance) Prefer prefix ++/-- operators for non-primitive types. [lib/cpp/src/thrift/concurrency/ThreadManager.cpp:354]: (performance) Prefer prefix ++/-- operators for non-primitive types. [lib/cpp/src/thrift/concurrency/ThreadManager.cpp:448]: (performance) Prefer prefix ++/-- operators for non-primitive types. [lib/cpp/src/thrift/concurrency/TimerManager.cpp:122]: (performance) Prefer prefix ++/-- operators for non-primitive types.
I also noticed that the TSocket constructor that takes a string argument does so by value instead of by reference.