From 5e2b63c65892e054980570957f533312cfd223c2 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 12 Nov 2011 01:23:45 -0500 Subject: [PATCH] Fix warnings in regex --- ChangeLog | 5 +++++ posix/regex_internal.c | 6 ++++-- posix/regex_internal.h | 5 ++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 192f38c4c0..897174e887 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-11-12 Ulrich Drepper + * posix/regex_internal.c (re_string_reconstruct): Actually use result + of use of trans. + * posix/regex_internal.h (re_string_wchar_at): Remove temporary + variable tmp. + * sysdeps/i386/i686/multiarch/wcscmp-c.c: Avoid warning. * sysdeps/i386/i686/multiarch/wcslen-c.c: Likewise. * sysdeps/i386/i686/multiarch/wmemcmp-c.c: Likewise. diff --git a/posix/regex_internal.c b/posix/regex_internal.c index 285ae3b38e..bc1924365b 100644 --- a/posix/regex_internal.c +++ b/posix/regex_internal.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2006, 2010 Free Software Foundation, Inc. + Copyright (C) 2002-2006, 2010, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -736,16 +736,18 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags) unsigned char buf[6]; size_t mbclen; + const unsigned char *pp = p; if (BE (pstr->trans != NULL, 0)) { int i = mlen < 6 ? mlen : 6; while (--i >= 0) buf[i] = pstr->trans[p[i]]; + pp = buf; } /* XXX Don't use mbrtowc, we know which conversion to use (UTF-8 -> UCS4). */ memset (&cur_state, 0, sizeof (cur_state)); - mbclen = __mbrtowc (&wc2, (const char *) p, mlen, + mbclen = __mbrtowc (&wc2, (const char *) pp, mlen, &cur_state); if (raw + offset - p <= mbclen && mbclen < (size_t) -2) diff --git a/posix/regex_internal.h b/posix/regex_internal.h index 65a9905860..74dd23074d 100644 --- a/posix/regex_internal.h +++ b/posix/regex_internal.h @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2005, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2002-2005, 2007, 2008, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -744,7 +744,6 @@ re_string_elem_size_at (const re_string_t *pstr, int idx) # ifdef _LIBC const unsigned char *p, *extra; const int32_t *table, *indirect; - int32_t tmp; # include uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); @@ -756,7 +755,7 @@ re_string_elem_size_at (const re_string_t *pstr, int idx) indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); p = pstr->mbs + idx; - tmp = findidx (&p); + findidx (&p); return p - pstr->mbs - idx; } else -- 2.43.5