Use strpbrk(3) instead of open coding it.

llvm-svn: 141328
This commit is contained in:
Benjamin Kramer 2011-10-06 22:53:35 +00:00
parent 5626c66a89
commit 8c26d440da
1 changed files with 1 additions and 8 deletions

View File

@ -70,13 +70,6 @@ const DerivedArgList &Compilation::getArgsForToolChain(const ToolChain *TC,
return *Entry;
}
static bool needsQuote(const char *s) {
for (const char *c = s; *c; ++c)
if (*c == ' ' || *c == '"' || *c == '\\' || *c == '$')
return true;
return false;
}
void Compilation::PrintJob(raw_ostream &OS, const Job &J,
const char *Terminator, bool Quote) const {
if (const Command *C = dyn_cast<Command>(&J)) {
@ -84,7 +77,7 @@ void Compilation::PrintJob(raw_ostream &OS, const Job &J,
for (ArgStringList::const_iterator it = C->getArguments().begin(),
ie = C->getArguments().end(); it != ie; ++it) {
OS << ' ';
if (!Quote && !needsQuote(*it)) {
if (!Quote && !std::strpbrk(*it, " \"\\$")) {
OS << *it;
continue;
}