Commit ee1765e5 by Ramsay Jones Committed by Andreas Ericsson

Fix sparse warnings: "Using plain integer as NULL pointer"

In order to suppress this warning, we could simply replace the
constant 0 with NULL. However, in this case, replacing the
comparison with 0 by !buffer is more idiomatic.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Andreas Ericsson <ae@op5.se>
parent 468b12ad
......@@ -133,14 +133,14 @@ int git_commit__parse_time(time_t *commit_time, char *buffer, const char *buffer
return GIT_EOBJCORRUPTED;
buffer = memchr(buffer, '\n', buffer_end - buffer);
if (buffer == 0 || ++buffer >= buffer_end)
if (!buffer || ++buffer >= buffer_end)
return GIT_EOBJCORRUPTED;
if (memcmp(buffer, "committer ", 10) != 0)
return GIT_EOBJCORRUPTED;
buffer = memchr(buffer, '>', buffer_end - buffer);
if (buffer == 0 || ++buffer >= buffer_end)
if (!buffer || ++buffer >= buffer_end)
return GIT_EOBJCORRUPTED;
*commit_time = strtol(buffer, &buffer, 10);
......@@ -149,7 +149,7 @@ int git_commit__parse_time(time_t *commit_time, char *buffer, const char *buffer
return GIT_EOBJCORRUPTED;
buffer = memchr(buffer, '\n', buffer_end - buffer);
if (buffer == 0 || ++buffer >= buffer_end)
if (!buffer || ++buffer >= buffer_end)
return GIT_EOBJCORRUPTED;
return (buffer < buffer_end) ? 0 : -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment