Internals: Remove some unneeded c_str() calls. No functional change.

This commit is contained in:
Wilson Snyder 2015-10-29 22:19:51 -04:00
parent 0d7b1a7dc7
commit faf5e1de51
3 changed files with 13 additions and 13 deletions

View File

@ -87,7 +87,7 @@ private:
if (!nodep->isToggleCoverable())
return "Not relevant signal type";
if (!v3Global.opt.coverageUnderscore()) {
if (prettyName.c_str()[0] == '_')
if (prettyName[0] == '_')
return "Leading underscore";
if (prettyName.find("._") != string::npos)
return "Inlined leading underscore";

View File

@ -563,9 +563,9 @@ bool V3Options::onoff(const char* sw, const char* arg, bool& flag) {
return false;
}
bool V3Options::suffixed(const char* sw, const char* arg) {
if (strlen(arg) > strlen(sw)) return false;
return (0==strcmp(sw+strlen(sw)-strlen(arg), arg));
bool V3Options::suffixed(const string& sw, const char* arg) {
if (strlen(arg) > sw.length()) return false;
return (0==strcmp(sw.c_str()+sw.length()-strlen(arg), arg));
}
void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char** argv) {
@ -962,16 +962,16 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
else {
// Filename
string filename = parseFileArg(optdir,argv[i]);
if (suffixed(filename.c_str(), ".cpp")
|| suffixed(filename.c_str(), ".cxx")
|| suffixed(filename.c_str(), ".cc")
|| suffixed(filename.c_str(), ".c")
|| suffixed(filename.c_str(), ".sp")) {
if (suffixed(filename, ".cpp")
|| suffixed(filename, ".cxx")
|| suffixed(filename, ".cc")
|| suffixed(filename, ".c")
|| suffixed(filename, ".sp")) {
V3Options::addCppFile(filename);
}
else if (suffixed(filename.c_str(), ".a")
|| suffixed(filename.c_str(), ".o")
|| suffixed(filename.c_str(), ".so")) {
else if (suffixed(filename, ".a")
|| suffixed(filename, ".o")
|| suffixed(filename, ".so")) {
V3Options::addLdLibs(filename);
}
else {

View File

@ -168,7 +168,7 @@ class V3Options {
void showVersion(bool verbose);
void coverage(bool flag) { m_coverageLine = m_coverageToggle = m_coverageUser = flag; }
bool onoff(const char* sw, const char* arg, bool& flag);
bool suffixed(const char* sw, const char* arg);
bool suffixed(const string& sw, const char* arg);
string parseFileArg(const string& optdir, const string& relfilename);
bool parseLangExt(const char* swp, const char* langswp, const V3LangCode& lc);
string filePathCheckOneDir(const string& modname, const string& dirname);