[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strcasestr compilation problem
From: |
Bruno Haible |
Subject: |
Re: strcasestr compilation problem |
Date: |
Wed, 31 Aug 2005 13:52:19 +0200 |
User-agent: |
KMail/1.5 |
Yoann Vandoorselaere wrote:
> The strcasestr module miss the inclusion of the stdio.h header,
> resulting in missing declaration for the NULL identifier on some
> systems.
Thanks. I committed the appended fix.
James Youngman writes:
> I haven't checked the code, but I suspect that a better choice would
> be to include <stdlib.h> which must also #define NULL.
<stddef.h>, <stdlib.h>, <stdio.h> all define NULL. (Both in the standards
and in reality.) I choose the one which minimizes the amount of unneeded
imported stuff, namely <stddef.h>.
Bruno
diff -c -3 -r1.13 strstr.c
*** strstr.c 19 Aug 2005 11:00:51 -0000 1.13
--- strstr.c 31 Aug 2005 11:49:44 -0000
***************
*** 23,28 ****
--- 23,30 ----
/* Specification. */
#include "strstr.h"
+ #include <stddef.h> /* for NULL */
+
#if HAVE_MBRTOWC
# include "mbuiter.h"
#endif
diff -c -3 -r1.2 strcasestr.c
*** strcasestr.c 19 Aug 2005 11:00:51 -0000 1.2
--- strcasestr.c 31 Aug 2005 11:49:44 -0000
***************
*** 24,29 ****
--- 24,30 ----
#include "strcasestr.h"
#include <ctype.h>
+ #include <stddef.h> /* for NULL */
#if HAVE_MBRTOWC
# include "mbuiter.h"