[RFC PATCH 2/9] xutil: #define _POSIX_C_SOURCE to get strdup()

Jani Nikula jani at nikula.org
Sat Jan 7 15:26:16 PST 2012


strdup() is not standard C99. #define _POSIX_C_SOURCE 200809L to use it.

This fixes -std=c99 -pedantic warning:

util/xutil.c: In function ‘xstrdup’:
util/xutil.c:74:5: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
util/xutil.c:74:9: warning: assignment makes pointer from integer without a cast [enabled by default]

Signed-off-by: Jani Nikula <jani at nikula.org>
---
 util/xutil.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/util/xutil.c b/util/xutil.c
index ac496da..55b818b 100644
--- a/util/xutil.c
+++ b/util/xutil.c
@@ -18,6 +18,8 @@
  * Author: Carl Worth <cworth at cworth.org>
  */
 
+#define _POSIX_C_SOURCE 200809L /* for strdup() */
+
 #include <stdio.h>
 #include <string.h>
 
-- 
1.7.5.4



More information about the notmuch mailing list