path: root/test-ctype.c
diff options
authorRené Scharfe <>2009-01-17 15:50:34 (GMT)
committerJunio C Hamano <>2009-01-18 02:30:37 (GMT)
commit8cc32992624ed4140fb136d98675f0f19b20ba09 (patch)
tree4b6b3164c5fd4dce658f5b08c86cc337853d7373 /test-ctype.c
parentc841aa8b903200f5d7830c7c4ab8d62b5ef44c5c (diff)
Change NUL char handling of isspecial()
Replace isspecial() by the new macro is_glob_special(), which is more, well, specialized. The former included the NUL char in its character class, while the letter only included characters that are special to file name globbing. The new name contains underscores because they enhance readability considerably now that it's made up of three words. Renaming the function is necessary to document its changed scope. The call sites of isspecial() are updated to check explicitly for NUL. Signed-off-by: Rene Scharfe <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'test-ctype.c')
1 files changed, 6 insertions, 0 deletions
diff --git a/test-ctype.c b/test-ctype.c
index 723eff4..d6425d5 100644
--- a/test-ctype.c
+++ b/test-ctype.c
@@ -21,6 +21,11 @@ static int test_isalnum(int c)
return isalnum(c);
+static int test_is_glob_special(int c)
+ return is_glob_special(c);
#define DIGIT "0123456789"
#define LOWER "abcdefghijklmnopqrstuvwxyz"
@@ -34,6 +39,7 @@ static const struct ctype_class {
{ "isspace", test_isspace, " \n\r\t" },
{ "isalpha", test_isalpha, LOWER UPPER },
{ "isalnum", test_isalnum, LOWER UPPER DIGIT },
+ { "is_glob_special", test_is_glob_special, "*?[\\" },
{ NULL }