Browse Source

str: fix warnings.

Firstly, -Wwrite-strings makes string literals const, secondly, we mustn't
define str_strstr etc in terms of themselves!
Rusty Russell 14 years ago
parent
commit
0845e79650
2 changed files with 5 additions and 1 deletions
  1. 3 0
      ccan/str/debug.c
  2. 2 1
      ccan/str/test/run.c

+ 3 - 0
ccan/str/debug.c

@@ -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)
 {

+ 2 - 1
ccan/str/test/run.c

@@ -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)