{"thread":{"id":"33640","subject":"[PATCH 4/6] compat/fnmatch/fnmatch.c: Fix a sparse error","startedAt":"2013-04-27T18:44:08Z","lastAt":"2013-04-27T18:44:08Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"215724","messageId":"517C1C78.3060206@ramsay1.demon.co.uk","threadId":"33640","inReplyTo":null,"subject":"[PATCH 4/6] compat/fnmatch/fnmatch.c: Fix a sparse error","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2013-04-27T18:44:08Z","receivedAt":"2013-04-27T18:44:08Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nSparse issues the following error and warnings:\n\n    SP compat/fnmatch/fnmatch.c\n.../fnmatch.c:144:17: warning: Using plain integer as NULL pointer\n.../fnmatch.c:238:67: warning: Using plain integer as NULL pointer\n.../fnmatch.c:303:40: error: too many arguments for function getenv\n\nThe error is caused by the extern declaration for the getenv function\nnot including the function prototype. Without the prototype, sparse\neffectively sees the declaration as 'char *getenv(void)'. In order to\nsuppress the error, we simply include the function prototype.\n\nIn order to suppress the warnings, we include the <stddef.h> header\nwhich provides an appropriate definition of the NULL macro, rather\nthan using the (inappropriate) default definition at fnmatch.c:132.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n compat/fnmatch/fnmatch.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/compat/fnmatch/fnmatch.c b/compat/fnmatch/fnmatch.c\nindex 5ef0685..378c467 100644\n--- a/compat/fnmatch/fnmatch.c\n+++ b/compat/fnmatch/fnmatch.c\n@@ -25,6 +25,7 @@\n # define _GNU_SOURCE\t1\n #endif\n \n+#include <stddef.h>\n #include <errno.h>\n #include <fnmatch.h>\n #include <ctype.h>\n@@ -121,7 +122,7 @@\n    whose names are inconsistent.  */\n \n # if !defined _LIBC && !defined getenv\n-extern char *getenv ();\n+extern char *getenv (const char *name);\n # endif\n \n # ifndef errno\n-- \n1.8.2\n"}]}