From: Joel Rosdahl Date: Sat, 17 Jul 2010 14:51:55 +0000 (+0200) Subject: Use strcmp == 0 instead of !strcmp X-Git-Tag: v3.1~161 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3d613aa587b47193bb356217886a64e13b0360b3;p=thirdparty%2Fccache.git Use strcmp == 0 instead of !strcmp --- diff --git a/execute.c b/execute.c index 3a8b34afc..30674ff90 100644 --- a/execute.c +++ b/execute.c @@ -114,7 +114,7 @@ int win32execute(char *path, char **argv, int doreturn, memset(&si, 0x00, sizeof(si)); ext = get_extension(path); - if (ext && !strcasecmp(ext, ".sh") && (path_env = getenv("PATH"))) + if (ext && strcasecmp(ext, ".sh") == 0 && (path_env = getenv("PATH"))) sh = find_executable_in_path("sh.exe", NULL, path_env); if (!sh && getenv("CCACHE_DETECT_SHEBANG")) { /* Detect shebang. */ @@ -124,7 +124,7 @@ int win32execute(char *path, char **argv, int doreturn, char buf[10]; fgets(buf, sizeof(buf), fp); buf[9] = 0; - if (!strcmp(buf, "#!/bin/sh") && (path_env = getenv("PATH"))) + if (strcmp(buf, "#!/bin/sh") == 0 && (path_env = getenv("PATH"))) sh = find_executable_in_path("sh.exe", NULL, path_env); fclose(fp); } diff --git a/util.c b/util.c index f887ed02b..13e84ccb3 100644 --- a/util.c +++ b/util.c @@ -922,16 +922,16 @@ int compare_executable_name(const char *s1, const char *s2) { #ifdef _WIN32 - int ret = !strcasecmp(s1, s2); - if (!ret) { + int eq = strcasecmp(s1, s2) == 0; + if (!eq) { char *tmp; x_asprintf(&tmp, "%s.exe", s2); - ret = !strcasecmp(s1, tmp); + eq = strcasecmp(s1, tmp) == 0; free(tmp); } - return ret; + return eq; #else - return !strcmp(s1, s2); + return strcmp(s1, s2) == 0; #endif }