lib/ccan/str: fix warnings.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 5 Dec 2011 06:12:46 +0000 (16:42 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 5 Dec 2011 06:12:46 +0000 (16:42 +1030)
Firstly, -Wwrite-strings makes string literals const, secondly, we mustn't
define str_strstr etc in terms of themselves!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 0845e79650c9257aa0ddef8ff99fd815b5edffac)

lib/ccan/str/debug.c
lib/ccan/str/test/run.c

index 9ef756766aa557b61e1ab4abeaaceba71900beaf..027915bc640cf091b9c9e2b58b00f68b80f1c583 100644 (file)
@@ -86,6 +86,9 @@ int str_isxdigit(int i)
        return isxdigit(i);
 }
 
+#undef strstr
+#undef strchr
+#undef strrchr
 
 char *str_strstr(const char *haystack, const char *needle)
 {
index a15654f8f32849831ae4814d39966970a26d8efc..f253746e7b354765a23456fc719affb81351a0d6 100644 (file)
@@ -6,7 +6,8 @@
 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
 
-static char *substrings[] = { "far", "bar", "baz", "b", "ba", "z", "ar", NULL };
+static const char *substrings[] = { "far", "bar", "baz", "b", "ba", "z", "ar",
+                                   NULL };
 
 #define NUM_SUBSTRINGS (ARRAY_SIZE(substrings) - 1)