convert strcmp() to util::StrEq
This commit is contained in:
parent
98ec95ca85
commit
84f6d75d26
2
caps.cc
2
caps.cc
@ -99,7 +99,7 @@ struct {
|
|||||||
|
|
||||||
int nameToVal(const char* name) {
|
int nameToVal(const char* name) {
|
||||||
for (const auto& cap : capNames) {
|
for (const auto& cap : capNames) {
|
||||||
if (strcmp(name, cap.name) == 0) {
|
if (util::StrEq(name, cap.name)) {
|
||||||
return cap.val;
|
return cap.val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,10 +253,10 @@ static bool containMakeFdsCOEProc(nsjconf_t* nsjconf) {
|
|||||||
if (entry == nullptr) {
|
if (entry == nullptr) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strcmp(".", entry->d_name) == 0) {
|
if (util::StrEq(".", entry->d_name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (strcmp("..", entry->d_name) == 0) {
|
if (util::StrEq("..", entry->d_name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
4
util.cc
4
util.cc
@ -215,6 +215,10 @@ bool isANumber(const char* s) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool StrEq(const std::string_view& s1, const std::string_view& s2) {
|
||||||
|
return (s1 == s2);
|
||||||
|
}
|
||||||
|
|
||||||
static __thread pthread_once_t rndThreadOnce = PTHREAD_ONCE_INIT;
|
static __thread pthread_once_t rndThreadOnce = PTHREAD_ONCE_INIT;
|
||||||
static __thread uint64_t rndX;
|
static __thread uint64_t rndX;
|
||||||
|
|
||||||
|
1
util.h
1
util.h
@ -62,6 +62,7 @@ std::string* StrAppend(std::string* str, const char* format, ...)
|
|||||||
__attribute__((format(printf, 2, 3)));
|
__attribute__((format(printf, 2, 3)));
|
||||||
std::string StrPrintf(const char* format, ...) __attribute__((format(printf, 1, 2)));
|
std::string StrPrintf(const char* format, ...) __attribute__((format(printf, 1, 2)));
|
||||||
const std::string StrQuote(const std::string& str);
|
const std::string StrQuote(const std::string& str);
|
||||||
|
bool StrEq(const std::string_view& s1, const std::string_view& s2);
|
||||||
bool isANumber(const char* s);
|
bool isANumber(const char* s);
|
||||||
uint64_t rnd64(void);
|
uint64_t rnd64(void);
|
||||||
const std::string sigName(int signo);
|
const std::string sigName(int signo);
|
||||||
|
Loading…
Reference in New Issue
Block a user