From 28c874cab7e1b272bf111150f691d6348fae1f2a Mon Sep 17 00:00:00 2001 From: Quipyowert2 <38995150+Quipyowert2@users.noreply.github.com> Date: Wed, 6 Mar 2019 22:14:05 -0800 Subject: Pass some strings by const&. This fixes a few warnings generated by Cppcheck 1.87. --- src/analysis/checks.cpp | 4 ++-- src/analysis/reports.cpp | 4 ++-- src/analysis/reports.h | 4 ++-- src/parsers/generic.cpp | 2 +- src/parsers/generic.h | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/analysis/checks.cpp b/src/analysis/checks.cpp index 96a4631..fb1abad 100644 --- a/src/analysis/checks.cpp +++ b/src/analysis/checks.cpp @@ -67,8 +67,8 @@ std::string mergeCollection(const std::set &col) void reportCollections(Node *node, const std::string &name, - std::set col1, - std::set col2) + const std::set& col1, + const std::set& col2) { std::string str1 = mergeCollection(col1); std::string str2 = mergeCollection(col2); diff --git a/src/analysis/reports.cpp b/src/analysis/reports.cpp index ddc78bb..c870d11 100644 --- a/src/analysis/reports.cpp +++ b/src/analysis/reports.cpp @@ -214,8 +214,8 @@ void reportWrongCheck(Node *node) void reportCollectionsDifferent(Node *node, const std::string &name, - std::string str1, - std::string str2) + const std::string& str1, + const std::string& str2) { std::string str = "internal collections '%s' is different.\nwant: " + str2 + diff --git a/src/analysis/reports.h b/src/analysis/reports.h index 7f65fb8..ab14435 100644 --- a/src/analysis/reports.h +++ b/src/analysis/reports.h @@ -59,8 +59,8 @@ namespace Analysis void reportCollectionsDifferent(Node *node, const std::string &name, - std::string str1, - std::string str2); + const std::string& str1, + const std::string& str2); } #endif // ANALYSIS_REPORTS_H diff --git a/src/parsers/generic.cpp b/src/parsers/generic.cpp index fd74e49..b263c6d 100644 --- a/src/parsers/generic.cpp +++ b/src/parsers/generic.cpp @@ -35,7 +35,7 @@ namespace Generic Node *createParseNode(Node *parent, tree gccNode, - std::string tag, + const std::string& tag, int parseChilds) { return createParseNode(parent, diff --git a/src/parsers/generic.h b/src/parsers/generic.h index 305c249..5477188 100644 --- a/src/parsers/generic.h +++ b/src/parsers/generic.h @@ -44,7 +44,7 @@ namespace Generic Node *createParseNode(Node *parent, tree gccNode, - std::string tag = "", + const std::string& tag = "", int parseChilds = INT_MAX); Node *createParseNode(Node *parent, -- cgit v1.2.3-70-g09d2