Commit 0845e796 authored by Rusty Russell's avatar Rusty Russell

str: fix warnings.

Firstly, -Wwrite-strings makes string literals const, secondly, we mustn't
define str_strstr etc in terms of themselves!
parent 942f2788
......@@ -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)
{
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment