Commit ee1765e529ab6b44adbcc6a0ff6e9ac1359c6cd6

Ramsay Jones 2010-06-01T19:32:41

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>

diff --git a/src/commit.c b/src/commit.c
index 3bbeff3..6110c89 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -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;