Skip to content

Commit

Permalink
tool_easysrc.c: Test pointers against NULL
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dwblaikie authored and bagder committed Sep 6, 2012
1 parent 2e7d2c8 commit 8b5d050
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tool_easysrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ CURLcode easysrc_perform(void)
const char *c;
CHKRET(easysrc_add(&easysrc_code, ""));
/* Preamble comment */
for(i=0; ((c = srchard[i]) != '\0'); i++)
for(i=0; ((c = srchard[i]) != NULL); i++)
CHKRET(easysrc_add(&easysrc_code, c));
/* Each unconverted option */
for(ptr=easysrc_toohard; ptr; ptr = ptr->next)
Expand Down Expand Up @@ -185,7 +185,7 @@ void dumpeasysrc(struct Configurable *config)
int i;
const char *c;

for(i=0; ((c = srchead[i]) != '\0'); i++)
for(i=0; ((c = srchead[i]) != NULL); i++)
fprintf(out, "%s\n", c);

/* Declare variables used for complex setopt values */
Expand Down Expand Up @@ -213,7 +213,7 @@ void dumpeasysrc(struct Configurable *config)
for(ptr=easysrc_clean; ptr; ptr = ptr->next)
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);

if(fopened)
Expand Down

0 comments on commit 8b5d050

Please sign in to comment.