aboutsummaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorRamsay Jones <ramsay@ramsay1.demon.co.uk>2013-04-27 19:44:08 +0100
committerJunio C Hamano <gitster@pobox.com>2013-04-28 12:24:40 -0700
commit4fc8fb48e978b8563493d04069c2507b7fb0064a (patch)
tree8605c95878031ca1f5cfa3dc41cbf4200628db2b /compat
parent5b62e6374aabb20297b22bdd72952ff582b2198b (diff)
downloadgit-4fc8fb48e978b8563493d04069c2507b7fb0064a.tar.gz
git-4fc8fb48e978b8563493d04069c2507b7fb0064a.tar.xz
compat/fnmatch/fnmatch.c: Fix a sparse error
Sparse issues the following error and warnings: SP compat/fnmatch/fnmatch.c .../fnmatch.c:144:17: warning: Using plain integer as NULL pointer .../fnmatch.c:238:67: warning: Using plain integer as NULL pointer .../fnmatch.c:303:40: error: too many arguments for function getenv The error is caused by the extern declaration for the getenv function not including the function prototype. Without the prototype, sparse effectively sees the declaration as 'char *getenv(void)'. In order to suppress the error, we simply include the function prototype. In order to suppress the warnings, we include the <stddef.h> header which provides an appropriate definition of the NULL macro, rather than using the (inappropriate) default definition at fnmatch.c:132. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r--compat/fnmatch/fnmatch.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/compat/fnmatch/fnmatch.c b/compat/fnmatch/fnmatch.c
index 5ef068513..378c46740 100644
--- a/compat/fnmatch/fnmatch.c
+++ b/compat/fnmatch/fnmatch.c
@@ -25,6 +25,7 @@
# define _GNU_SOURCE 1
#endif
+#include <stddef.h>
#include <errno.h>
#include <fnmatch.h>
#include <ctype.h>
@@ -121,7 +122,7 @@
whose names are inconsistent. */
# if !defined _LIBC && !defined getenv
-extern char *getenv ();
+extern char *getenv (const char *name);
# endif
# ifndef errno