summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
942f278)
Firstly, -Wwrite-strings makes string literals const, secondly, we mustn't
define str_strstr etc in terms of themselves!
+#undef strstr
+#undef strchr
+#undef strrchr
char *str_strstr(const char *haystack, const char *needle)
{
char *str_strstr(const char *haystack, const char *needle)
{
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
#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)
#define NUM_SUBSTRINGS (ARRAY_SIZE(substrings) - 1)