summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-26 20:13:07 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-26 20:13:07 +0930
commit0845e79650c9257aa0ddef8ff99fd815b5edffac (patch)
tree72123c96eab9104bf96702e902cc746249eb0021
parent942f2788e165bb203b0f160f29bd4592f32dc344 (diff)
str: fix warnings.
Firstly, -Wwrite-strings makes string literals const, secondly, we mustn't define str_strstr etc in terms of themselves!
-rw-r--r--ccan/str/debug.c3
-rw-r--r--ccan/str/test/run.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/ccan/str/debug.c b/ccan/str/debug.c
index 9ef75676..027915bc 100644
--- a/ccan/str/debug.c
+++ b/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)
{
diff --git a/ccan/str/test/run.c b/ccan/str/test/run.c
index 3ccadbe5..0f00ea32 100644
--- a/ccan/str/test/run.c
+++ b/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)