1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-25 06:04:04 +03:00
Rusty Russell 00b226bfe4 lib/ccan/str: fix warnings.
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)
2011-12-05 16:42:46 +10:30

108 lines
1.5 KiB
C

#include "config.h"
#include <ccan/str/str_debug.h>
#include <assert.h>
#include <ctype.h>
#include <string.h>
#ifdef CCAN_STR_DEBUG
/* Because we mug the real ones with macros, we need our own wrappers. */
int str_isalnum(int i)
{
assert(i >= -1 && i < 256);
return isalnum(i);
}
int str_isalpha(int i)
{
assert(i >= -1 && i < 256);
return isalpha(i);
}
int str_isascii(int i)
{
assert(i >= -1 && i < 256);
return isascii(i);
}
#if HAVE_ISBLANK
int str_isblank(int i)
{
assert(i >= -1 && i < 256);
return isblank(i);
}
#endif
int str_iscntrl(int i)
{
assert(i >= -1 && i < 256);
return iscntrl(i);
}
int str_isdigit(int i)
{
assert(i >= -1 && i < 256);
return isdigit(i);
}
int str_isgraph(int i)
{
assert(i >= -1 && i < 256);
return isgraph(i);
}
int str_islower(int i)
{
assert(i >= -1 && i < 256);
return islower(i);
}
int str_isprint(int i)
{
assert(i >= -1 && i < 256);
return isprint(i);
}
int str_ispunct(int i)
{
assert(i >= -1 && i < 256);
return ispunct(i);
}
int str_isspace(int i)
{
assert(i >= -1 && i < 256);
return isspace(i);
}
int str_isupper(int i)
{
assert(i >= -1 && i < 256);
return isupper(i);
}
int str_isxdigit(int i)
{
assert(i >= -1 && i < 256);
return isxdigit(i);
}
#undef strstr
#undef strchr
#undef strrchr
char *str_strstr(const char *haystack, const char *needle)
{
return strstr(haystack, needle);
}
char *str_strchr(const char *haystack, int c)
{
return strchr(haystack, c);
}
char *str_strrchr(const char *haystack, int c)
{
return strrchr(haystack, c);
}
#endif