diff options
author | vvs31415 <vvs31415@users.noreply.github.com> | 2021-03-13 12:00:00 (GMT) |
---|---|---|
committer | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2021-03-13 12:36:07 (GMT) |
commit | 12624ebd7ee1380b5e5aa0bc3bcbb03c4d9aec73 (patch) | |
tree | 58a7df28ea4ebc050db603ebd3bca79ca5aeb77c /Source/cmListCommand.cxx | |
parent | 982f7bb5063453d3c0be102c917bb660ec21978b (diff) | |
download | CMake-12624ebd7ee1380b5e5aa0bc3bcbb03c4d9aec73.zip CMake-12624ebd7ee1380b5e5aa0bc3bcbb03c4d9aec73.tar.gz CMake-12624ebd7ee1380b5e5aa0bc3bcbb03c4d9aec73.tar.bz2 |
Source: Reduce c_str() usage
Diffstat (limited to 'Source/cmListCommand.cxx')
-rw-r--r-- | Source/cmListCommand.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 1bafdf7..09cd88e 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -34,7 +34,7 @@ namespace { -bool GetIndexArg(char const* arg, int* idx, cmMakefile& mf) +bool GetIndexArg(const std::string& arg, int* idx, cmMakefile& mf) { long value; if (!cmStrToLong(arg, &value)) { @@ -189,7 +189,7 @@ bool HandleGetCommand(std::vector<std::string> const& args, size_t nitem = varArgsExpanded.size(); for (cc = 2; cc < args.size() - 1; cc++) { int item; - if (!GetIndexArg(args[cc].c_str(), &item, status.GetMakefile())) { + if (!GetIndexArg(args[cc], &item, status.GetMakefile())) { status.SetError(cmStrCat("index: ", args[cc], " is not a valid index")); return false; } @@ -401,7 +401,7 @@ bool HandleInsertCommand(std::vector<std::string> const& args, // expand the variable int item; - if (!GetIndexArg(args[2].c_str(), &item, status.GetMakefile())) { + if (!GetIndexArg(args[2], &item, status.GetMakefile())) { status.SetError(cmStrCat("index: ", args[2], " is not a valid index")); return false; } @@ -1326,11 +1326,11 @@ bool HandleSublistCommand(std::vector<std::string> const& args, int start; int length; - if (!GetIndexArg(args[2].c_str(), &start, status.GetMakefile())) { + if (!GetIndexArg(args[2], &start, status.GetMakefile())) { status.SetError(cmStrCat("index: ", args[2], " is not a valid index")); return false; } - if (!GetIndexArg(args[3].c_str(), &length, status.GetMakefile())) { + if (!GetIndexArg(args[3], &length, status.GetMakefile())) { status.SetError(cmStrCat("index: ", args[3], " is not a valid index")); return false; } @@ -1389,7 +1389,7 @@ bool HandleRemoveAtCommand(std::vector<std::string> const& args, size_t nitem = varArgsExpanded.size(); for (cc = 2; cc < args.size(); ++cc) { int item; - if (!GetIndexArg(args[cc].c_str(), &item, status.GetMakefile())) { + if (!GetIndexArg(args[cc], &item, status.GetMakefile())) { status.SetError(cmStrCat("index: ", args[cc], " is not a valid index")); return false; } |