summaryrefslogtreecommitdiff
path: root/lib/ccan/str/debug.c
blob: 42d19f8197f9ff03795397843a1385e19a1a225f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* Licensed under LGPLv2.1+ - see LICENSE file for details */
#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);
}


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