tool_easysrc.c: Test pointers against NULL

While validating a new Clang diagnostic (-Wnon-literal-null-conversion -
yes, the name isn't quite correct in this case, but it suffices) I found
a few violations of it in Curl.
This commit is contained in:
David Blaikie
2012-09-06 21:00:26 +02:00
committed by Daniel Stenberg
parent 2e7d2c8f74
commit 8b5d050267

View File

@@ -140,7 +140,7 @@ CURLcode easysrc_perform(void)
const char *c; const char *c;
CHKRET(easysrc_add(&easysrc_code, "")); CHKRET(easysrc_add(&easysrc_code, ""));
/* Preamble comment */ /* Preamble comment */
for(i=0; ((c = srchard[i]) != '\0'); i++) for(i=0; ((c = srchard[i]) != NULL); i++)
CHKRET(easysrc_add(&easysrc_code, c)); CHKRET(easysrc_add(&easysrc_code, c));
/* Each unconverted option */ /* Each unconverted option */
for(ptr=easysrc_toohard; ptr; ptr = ptr->next) for(ptr=easysrc_toohard; ptr; ptr = ptr->next)
@@ -185,7 +185,7 @@ void dumpeasysrc(struct Configurable *config)
int i; int i;
const char *c; const char *c;
for(i=0; ((c = srchead[i]) != '\0'); i++) for(i=0; ((c = srchead[i]) != NULL); i++)
fprintf(out, "%s\n", c); fprintf(out, "%s\n", c);
/* Declare variables used for complex setopt values */ /* Declare variables used for complex setopt values */
@@ -213,7 +213,7 @@ void dumpeasysrc(struct Configurable *config)
for(ptr=easysrc_clean; ptr; ptr = ptr->next) for(ptr=easysrc_clean; ptr; ptr = ptr->next)
fprintf(out, " %s\n", ptr->data); fprintf(out, " %s\n", ptr->data);
for(i=0; ((c = srcend[i]) != '\0'); i++) for(i=0; ((c = srcend[i]) != NULL); i++)
fprintf(out, "%s\n", c); fprintf(out, "%s\n", c);
if(fopened) if(fopened)