summaryrefslogtreecommitdiff
path: root/lib/regcomp.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-08-11 19:07:43 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-08-11 19:08:29 -0700
commitd64c1be99036d083d1d0db97ed1f41b1dd1005bc (patch)
treea509acaac4b35e88057a71688838088177d65a96 /lib/regcomp.c
parent1145bd0ef97630473746fb96da00951ae81c358c (diff)
downloademacs-d64c1be99036d083d1d0db97ed1f41b1dd1005bc.tar.gz
emacs-d64c1be99036d083d1d0db97ed1f41b1dd1005bc.tar.bz2
emacs-d64c1be99036d083d1d0db97ed1f41b1dd1005bc.zip
Update from Gnulib
This incorporates: 2018-08-11 verify: port 'assume' to traditional tools * build-aux/config.sub, lib/regcomp.c, lib/verify.h: Copy from Gnulib. * lib/gnulib.mk.in: Regenerate.
Diffstat (limited to 'lib/regcomp.c')
-rw-r--r--lib/regcomp.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 53eb2263740..0e4816c89c2 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -2684,15 +2684,14 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
# ifdef RE_ENABLE_I18N
/* Convert the byte B to the corresponding wide character. In a
- unibyte locale, treat B as itself if it is an encoding error.
- In a multibyte locale, return WEOF if B is an encoding error. */
+ unibyte locale, treat B as itself. In a multibyte locale, return
+ WEOF if B is an encoding error. */
static wint_t
parse_byte (unsigned char b, re_charset_t *mbcset)
{
- wint_t wc = __btowc (b);
- return wc == WEOF && !mbcset ? b : wc;
+ return mbcset == NULL ? b : __btowc (b);
}
-#endif
+# endif
/* Local function for parse_bracket_exp only used in case of NOT _LIBC.
Build the range expression which starts from START_ELEM, and ends
@@ -3531,18 +3530,10 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
continue;
/* Compare only if the length matches and the collation rule
index is the same. */
- if (len == weights[idx2 & 0xffffff] && (idx1 >> 24) == (idx2 >> 24))
- {
- int cnt = 0;
-
- while (cnt <= len &&
- weights[(idx1 & 0xffffff) + 1 + cnt]
- == weights[(idx2 & 0xffffff) + 1 + cnt])
- ++cnt;
-
- if (cnt > len)
- bitset_set (sbcset, ch);
- }
+ if (len == weights[idx2 & 0xffffff] && (idx1 >> 24) == (idx2 >> 24)
+ && memcmp (weights + (idx1 & 0xffffff) + 1,
+ weights + (idx2 & 0xffffff) + 1, len) == 0)
+ bitset_set (sbcset, ch);
}
/* Check whether the array has enough space. */
if (BE (*equiv_class_alloc == mbcset->nequiv_classes, 0))
@@ -3802,9 +3793,9 @@ free_charset (re_charset_t *cset)
# ifdef _LIBC
re_free (cset->coll_syms);
re_free (cset->equiv_classes);
+# endif
re_free (cset->range_starts);
re_free (cset->range_ends);
-# endif
re_free (cset->char_classes);
re_free (cset);
}