[clang-tidy] Use strcmp family properly

Found with bugprone-suspicious-string-compare

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2019-11-25 17:31:57 -08:00 committed by ridiculousfish
parent e45ae9df49
commit e4a7e7d4f7
3 changed files with 3 additions and 3 deletions

View File

@ -258,7 +258,7 @@ static int report_function_metadata(const wchar_t *funcname, bool verbose, io_st
}
if (metadata_as_comments) {
if (std::wcscmp(path, L"stdin")) {
if (std::wcscmp(path, L"stdin") != 0) {
wcstring comment;
append_format(comment, L"# Defined in %ls @ line %d\n", path, line_number);
if (!streams.out_is_redirected && isatty(STDOUT_FILENO)) {

View File

@ -507,7 +507,7 @@ static void init_locale(const environment_t &vars) {
FLOGF(env_locale, L"old LC_MESSAGES locale: '%s'", old_msg_locale);
FLOGF(env_locale, L"new LC_MESSAGES locale: '%s'", new_msg_locale);
#ifdef HAVE__NL_MSG_CAT_CNTR
if (std::strcmp(old_msg_locale, new_msg_locale)) {
if (std::strcmp(old_msg_locale, new_msg_locale) != 0) {
// Make change known to GNU gettext.
extern int _nl_msg_cat_cntr;
_nl_msg_cat_cntr++;

View File

@ -265,7 +265,7 @@ static history_item_t decode_item_fish_2_0(const char *base, size_t len) {
size_t advance = read_line(base, cursor, len, line);
if (trim_leading_spaces(line) <= indent) break;
if (std::strncmp(line.c_str(), "- ", 2)) break;
if (std::strncmp(line.c_str(), "- ", 2) != 0) break;
// We're going to consume this line.
cursor += advance;