diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2017-09-05 11:02:24 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2017-09-08 16:34:04 +0200 |
commit | 07b4f49db285f39594859c58893e3404b33200dd (patch) | |
tree | 7c013b255ca113a69fba1ddf5281ca8f3e39ab0b /posix/glob_internal.h | |
parent | 116f1c64d8d84ecbf269ac70a35657aa057f26c3 (diff) | |
download | glibc-07b4f49db285f39594859c58893e3404b33200dd.tar.gz glibc-07b4f49db285f39594859c58893e3404b33200dd.tar.xz glibc-07b4f49db285f39594859c58893e3404b33200dd.zip |
posix: Use enum for __glob_pattern_type result
This patch replaces the internal integer constant from __glob_pattern_type return with a proper enum. Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py for all major architectures. * posix/glob_internal.h (glob_pattern_type_t): New enumeration. (__glob_pattern_type): Use __glob_pat_types. * posix/glob_pattern_p.c (__glob_pattern_p): Likewise. * posix/glob.c (glob): Likewise. (glob_in_dir): Likewise.
Diffstat (limited to 'posix/glob_internal.h')
-rw-r--r-- | posix/glob_internal.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/posix/glob_internal.h b/posix/glob_internal.h index 12c93660b7..d118b3533d 100644 --- a/posix/glob_internal.h +++ b/posix/glob_internal.h @@ -19,35 +19,43 @@ #ifndef GLOB_INTERNAL_H # define GLOB_INTERNAL_H +enum +{ + GLOBPAT_NONE = 0x0, + GLOBPAT_SPECIAL = 0x1, + GLOBPAT_BACKSLASH = 0x2, + GLOBPAT_BRACKET = 0x4 +}; + static inline int __glob_pattern_type (const char *pattern, int quote) { const char *p; - int ret = 0; + int ret = GLOBPAT_NONE; for (p = pattern; *p != '\0'; ++p) switch (*p) { case '?': case '*': - return 1; + return GLOBPAT_SPECIAL; case '\\': if (quote) { if (p[1] != '\0') ++p; - ret |= 2; + ret |= GLOBPAT_BACKSLASH; } break; case '[': - ret |= 4; + ret |= GLOBPAT_BRACKET; break; case ']': if (ret & 4) - return 1; + return GLOBPAT_SPECIAL; break; } |