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)
return isxdigit(i);
}
+#undef strstr
+#undef strchr
+#undef strrchr
char *str_strstr(const char *haystack, const char *needle)
{
#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)