Skip to content

Commit ad8599f

Browse files
firewavedanmar
authored andcommitted
fixed some clang-tidy and CLion inspection warnings (#165)
1 parent 9cd5547 commit ad8599f

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int main(int argc, char **argv)
3232
if (std::strncmp(arg, "-include=",9)==0)
3333
dui.includes.push_back(arg+9);
3434
break;
35-
};
35+
}
3636
} else {
3737
filename = arg;
3838
}

simplecpp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,17 @@ void simplecpp::Location::adjust(const std::string &str)
149149

150150
bool simplecpp::Token::isOneOf(const char ops[]) const
151151
{
152-
return (op != '\0') && (std::strchr(ops, op) != 0);
152+
return (op != '\0') && (std::strchr(ops, op) != NULL);
153153
}
154154

155155
bool simplecpp::Token::startsWithOneOf(const char c[]) const
156156
{
157-
return std::strchr(c, string[0]) != 0;
157+
return std::strchr(c, string[0]) != NULL;
158158
}
159159

160160
bool simplecpp::Token::endsWithOneOf(const char c[]) const
161161
{
162-
return std::strchr(c, string[string.size() - 1U]) != 0;
162+
return std::strchr(c, string[string.size() - 1U]) != NULL;
163163
}
164164

165165
void simplecpp::Token::printAll() const
@@ -2685,7 +2685,7 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
26852685
} else if (pragmaOnce.find(header2) == pragmaOnce.end()) {
26862686
includetokenstack.push(gotoNextLine(rawtok));
26872687
const TokenList *includetokens = filedata.find(header2)->second;
2688-
rawtok = includetokens ? includetokens->cfront() : 0;
2688+
rawtok = includetokens ? includetokens->cfront() : NULL;
26892689
continue;
26902690
}
26912691
} else if (rawtok->str() == IF || rawtok->str() == IFDEF || rawtok->str() == IFNDEF || rawtok->str() == ELIF) {

simplecpp.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ namespace simplecpp {
179179
class SIMPLECPP_LIB TokenList {
180180
public:
181181
explicit TokenList(std::vector<std::string> &filenames);
182-
TokenList(std::istream &istr, std::vector<std::string> &filenames, const std::string &filename=std::string(), OutputList *outputList = 0);
182+
TokenList(std::istream &istr, std::vector<std::string> &filenames, const std::string &filename=std::string(), OutputList *outputList = NULL);
183183
TokenList(const TokenList &other);
184184
#if __cplusplus >= 201103L
185185
TokenList(TokenList &&other);
@@ -199,7 +199,7 @@ namespace simplecpp {
199199
void dump() const;
200200
std::string stringify() const;
201201

202-
void readfile(std::istream &istr, const std::string &filename=std::string(), OutputList *outputList = 0);
202+
void readfile(std::istream &istr, const std::string &filename=std::string(), OutputList *outputList = NULL);
203203
void constFold();
204204

205205
void removeComments();
@@ -264,7 +264,7 @@ namespace simplecpp {
264264
void constFoldLogicalOp(Token *tok);
265265
void constFoldQuestionOp(Token **tok1);
266266

267-
std::string readUntil(std::istream &istr, const Location &location, const char start, const char end, OutputList *outputList, unsigned int bom);
267+
std::string readUntil(std::istream &istr, const Location &location, char start, char end, OutputList *outputList, unsigned int bom);
268268
void lineDirective(unsigned int fileIndex, unsigned int line, Location *location);
269269

270270
std::string lastLine(int maxsize=100000) const;
@@ -297,7 +297,7 @@ namespace simplecpp {
297297
std::list<std::string> includes;
298298
};
299299

300-
SIMPLECPP_LIB std::map<std::string, TokenList*> load(const TokenList &rawtokens, std::vector<std::string> &filenames, const DUI &dui, OutputList *outputList = 0);
300+
SIMPLECPP_LIB std::map<std::string, TokenList*> load(const TokenList &rawtokens, std::vector<std::string> &filenames, const DUI &dui, OutputList *outputList = NULL);
301301

302302
/**
303303
* Preprocess
@@ -310,7 +310,7 @@ namespace simplecpp {
310310
* @param outputList output: list that will receive output messages
311311
* @param macroUsage output: macro usage
312312
*/
313-
SIMPLECPP_LIB void preprocess(TokenList &output, const TokenList &rawtokens, std::vector<std::string> &files, std::map<std::string, TokenList*> &filedata, const DUI &dui, OutputList *outputList = 0, std::list<MacroUsage> *macroUsage = 0);
313+
SIMPLECPP_LIB void preprocess(TokenList &output, const TokenList &rawtokens, std::vector<std::string> &files, std::map<std::string, TokenList*> &filedata, const DUI &dui, OutputList *outputList = NULL, std::list<MacroUsage> *macroUsage = NULL);
314314

315315
/**
316316
* Deallocate data

test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ static void missingHeader2()
10601060
std::istringstream istr("#include \"foo.h\"\n"); // this file exists
10611061
std::vector<std::string> files;
10621062
std::map<std::string, simplecpp::TokenList*> filedata;
1063-
filedata["foo.h"] = 0;
1063+
filedata["foo.h"] = NULL;
10641064
simplecpp::OutputList outputList;
10651065
simplecpp::TokenList tokens2(files);
10661066
simplecpp::preprocess(tokens2, simplecpp::TokenList(istr,files), files, filedata, dui, &outputList);

0 commit comments

Comments
 (0)