summaryrefslogtreecommitdiff
path: root/posix/regcomp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-10-14 05:54:47 +0000
committerUlrich Drepper <drepper@redhat.com>2005-10-14 05:54:47 +0000
commit513bbb254d123f72b60be5c935666a9b841bedc5 (patch)
treea9b8817ab76a7fb157e5b4f67afc15774d622377 /posix/regcomp.c
parentdb26cb757680e02df3a47d2cfa47d101597cf0e6 (diff)
[BZ #1373]
2005-10-13 Ulrich Drepper <drepper@redhat.com> [BZ #1373] * argp/argp.h: Remove __NTH for __argp_usage inline function.
Diffstat (limited to 'posix/regcomp.c')
-rw-r--r--posix/regcomp.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 353689e186..269d6a6b5f 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -3487,39 +3487,45 @@ build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset,
#endif /* RE_ENABLE_I18N */
#define BUILD_CHARCLASS_LOOP(ctype_func) \
- for (i = 0; i < SBC_MAX; ++i) \
+ do { \
+ if (BE (trans != NULL, 0)) \
{ \
- if (ctype_func (i)) \
- { \
- int ch = trans ? trans[i] : i; \
- bitset_set (sbcset, ch); \
- } \
- }
+ for (i = 0; i < SBC_MAX; ++i) \
+ if (ctype_func (i)) \
+ bitset_set (sbcset, trans[i]); \
+ } \
+ else \
+ { \
+ for (i = 0; i < SBC_MAX; ++i) \
+ if (ctype_func (i)) \
+ bitset_set (sbcset, i); \
+ } \
+ } while (0)
if (strcmp (name, "alnum") == 0)
- BUILD_CHARCLASS_LOOP (isalnum)
+ BUILD_CHARCLASS_LOOP (isalnum);
else if (strcmp (name, "cntrl") == 0)
- BUILD_CHARCLASS_LOOP (iscntrl)
+ BUILD_CHARCLASS_LOOP (iscntrl);
else if (strcmp (name, "lower") == 0)
- BUILD_CHARCLASS_LOOP (islower)
+ BUILD_CHARCLASS_LOOP (islower);
else if (strcmp (name, "space") == 0)
- BUILD_CHARCLASS_LOOP (isspace)
+ BUILD_CHARCLASS_LOOP (isspace);
else if (strcmp (name, "alpha") == 0)
- BUILD_CHARCLASS_LOOP (isalpha)
+ BUILD_CHARCLASS_LOOP (isalpha);
else if (strcmp (name, "digit") == 0)
- BUILD_CHARCLASS_LOOP (isdigit)
+ BUILD_CHARCLASS_LOOP (isdigit);
else if (strcmp (name, "print") == 0)
- BUILD_CHARCLASS_LOOP (isprint)
+ BUILD_CHARCLASS_LOOP (isprint);
else if (strcmp (name, "upper") == 0)
- BUILD_CHARCLASS_LOOP (isupper)
+ BUILD_CHARCLASS_LOOP (isupper);
else if (strcmp (name, "blank") == 0)
- BUILD_CHARCLASS_LOOP (isblank)
+ BUILD_CHARCLASS_LOOP (isblank);
else if (strcmp (name, "graph") == 0)
- BUILD_CHARCLASS_LOOP (isgraph)
+ BUILD_CHARCLASS_LOOP (isgraph);
else if (strcmp (name, "punct") == 0)
- BUILD_CHARCLASS_LOOP (ispunct)
+ BUILD_CHARCLASS_LOOP (ispunct);
else if (strcmp (name, "xdigit") == 0)
- BUILD_CHARCLASS_LOOP (isxdigit)
+ BUILD_CHARCLASS_LOOP (isxdigit);
else
return REG_ECTYPE;