add SafeStrCmp

This commit is contained in:
aozhiwei 2020-05-22 16:11:07 +08:00
parent c6c7cb379e
commit 837e2d9f9e
2 changed files with 6 additions and 0 deletions

View File

@ -393,4 +393,9 @@ namespace a8
return true;
}
int SafeStrCmp(const char* s1, const char* s2)
{
return strcmp(s1 ? s1 : "", s2 ? s2 : "");
}
}

View File

@ -27,6 +27,7 @@ namespace a8
std::string JsonEscapeString(const std::string& str);
std::string IntToFixedString(int val, int n);
bool ReadStringFromFile(const std::string& filename, std::string& data);
int SafeStrCmp(const char* s1, const char* s2);
}