str: provide checks for ctype.h char functions, and strstr and strchr functions.
In the former case, we were bitten by the fact that you don't pass a char to isalpha() et al: you pass an int. This means on most platforms you want to do: if (isalpha((unsigned char)c)) ... Insane? Yes, but I assure you I'm not making this up. Similarly, I've always wanted strstr, strchr and strrchr to return const char * when given a const char * argument to search, to avoid constness leak. In both cases, the actual versions from the headers may be macros, so we need to be very careful overriding them. The result is that they become out-of-line functions which is unacceptable for general performance. So we only activate these when CCAN_STR_DEBUG is defined.
Showing
ccan/str/debug.c
0 → 100644
ccan/str/str_debug.h
0 → 100644
ccan/str/test/debug.c
0 → 100644
Please register or sign in to comment