Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coding style: rename parse_int() -> parseInt() #166

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/cwe-name-lookup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ bool CweNameLookup::handleLine(const TStringList &fields)

// parse CWE number
const std::string &cweId = fields[/* CWE */ 0];
const int cwe = parse_int(cweId, -1);
const int cwe = parseInt(cweId, -1);
if (cwe < 0) {
// we use "unmapped" for findings without any CWE assigned
// as discussed in https://github.com/csutils/csdiff/pull/61
Expand Down
2 changes: 1 addition & 1 deletion src/lib/parser-common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <boost/algorithm/string/replace.hpp>
#include <boost/lexical_cast.hpp>

int parse_int(const std::string &str, const int fallback)
int parseInt(const std::string &str, const int fallback)
{
try {
return boost::lexical_cast<int>(str);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/parser-common.hh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#define RE_EVENT_SIGMA "(?:Sigma (?:main )?event)"
#define RE_EVENT RE_EVENT_GCC "|" RE_EVENT_PROSPECTOR "|" RE_EVENT_SIGMA

int parse_int(const std::string &, int fallback = 0);
int parseInt(const std::string &, int fallback = 0);

class ImpliedAttrDigger {
public:
Expand Down
6 changes: 3 additions & 3 deletions src/lib/parser-cov.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ EToken ErrFileLexer::readNext()
evt_.msg = sm[/* msg */ 5];

// parse line number
evt_.line = parse_int(sm[/* line */ 2]);
evt_.line = parseInt(sm[/* line */ 2]);

// parse column number
evt_.column = parse_int(sm[/* col */ 3]);
evt_.column = parseInt(sm[/* col */ 3]);

return T_EVENT;
}
Expand Down Expand Up @@ -479,7 +479,7 @@ void AnnotHandler::handleDef(Defect *pDef)
{
boost::smatch sm;
if (boost::regex_match(pDef->annotation, sm, reCweAnnot_)) {
pDef->cwe = parse_int(sm[/* cwe */ 1]);
pDef->cwe = parseInt(sm[/* cwe */ 1]);
pDef->annotation.clear();
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/lib/parser-gcc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ EToken Tokenizer::readNext(DefEvent *pEvt)
pEvt->fileName = sm["file"];

// parse line number
pEvt->line = parse_int(sm["line"]);
pEvt->line = parseInt(sm["line"]);

// parse column number
pEvt->column = parse_int(sm["col"]);
pEvt->column = parseInt(sm["col"]);

return tok;
}
Expand Down Expand Up @@ -467,7 +467,7 @@ bool BasicGccParser::digCppcheckEvt(Defect *pDef)
keyEvt.event += "]";

// store CWE if available
pDef->cwe = parse_int(sm[/* cwe */ 2]);
pDef->cwe = parseInt(sm[/* cwe */ 2]);

// this assignment invalidates sm!
keyEvt.msg = sm[/* msg */ 3];
Expand Down Expand Up @@ -628,7 +628,7 @@ void GccPostProcessor::Private::transGccAnal(Defect *pDef) const
if (!boost::regex_match(keyEvt.msg, sm, this->reGccAnalCwe))
return;

pDef->cwe = parse_int(sm[/* cwe */ 2]);
pDef->cwe = parseInt(sm[/* cwe */ 2]);
// this invalidates sm
keyEvt.msg = sm[/* msg */ 1];
}
Expand Down