THRIFT-3067 C++ cppcheck performance related warnings
Patch: Arijit Chattopadhyay <arijitnit06@gmail.com>
This closes #444
diff --git a/compiler/cpp/src/parse/t_enum.h b/compiler/cpp/src/parse/t_enum.h
index 59941e3..12b4ad8 100644
--- a/compiler/cpp/src/parse/t_enum.h
+++ b/compiler/cpp/src/parse/t_enum.h
@@ -31,13 +31,13 @@
public:
t_enum(t_program* program) : t_type(program) {}
- void set_name(const std::string& name) { name_ = name; }
+ void set_name(const std::string &name) { name_ = name; }
void append(t_enum_value* constant) { constants_.push_back(constant); }
const std::vector<t_enum_value*>& get_constants() { return constants_; }
- t_enum_value* get_constant_by_name(const std::string name) {
+ t_enum_value* get_constant_by_name(const std::string& name) {
const std::vector<t_enum_value*>& enum_values = get_constants();
std::vector<t_enum_value*>::const_iterator c_iter;
for (c_iter = enum_values.begin(); c_iter != enum_values.end(); ++c_iter) {
diff --git a/compiler/cpp/src/parse/t_service.h b/compiler/cpp/src/parse/t_service.h
index 091403d..1f49972 100644
--- a/compiler/cpp/src/parse/t_service.h
+++ b/compiler/cpp/src/parse/t_service.h
@@ -39,7 +39,7 @@
void add_function(t_function* func) {
std::vector<t_function*>::const_iterator iter;
- for (iter = functions_.begin(); iter != functions_.end(); iter++) {
+ for (iter = functions_.begin(); iter != functions_.end(); ++iter) {
if (func->get_name() == (*iter)->get_name()) {
throw "Function " + func->get_name() + " is already defined";
}