Skip to content

Commit

Permalink
Use const_cast instead of C-style casts
Browse files Browse the repository at this point in the history
Found by Cppcheck (cstyleCast)
  • Loading branch information
gruenich committed May 1, 2024
1 parent d448ce0 commit cd7364e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/browse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void RunBrowsePython(State* state, const char* ninja_command,
command.push_back(argv[i]);
}
command.push_back(NULL);
execvp(command[0], (char**)&command[0]);
execvp(command[0], const_cast<char**>(&command[0]));
if (errno == ENOENT) {
printf("ninja: %s is required for the browse tool\n", NINJA_PYTHON);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/deps_log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ bool DepsLog::OpenForWrite(const string& path, string* err) {
bool DepsLog::RecordDeps(Node* node, TimeStamp mtime,
const vector<Node*>& nodes) {
return RecordDeps(node, mtime, nodes.size(),
nodes.empty() ? NULL : (Node**)&nodes.front());
nodes.empty() ? NULL : const_cast<Node**>(&nodes.front()));
}

bool DepsLog::RecordDeps(Node* node, TimeStamp mtime,
Expand Down

0 comments on commit cd7364e

Please sign in to comment.