Fix warnings in regex

This commit is contained in:
Ulrich Drepper 2011-11-12 01:23:45 -05:00
parent e7f4b08ee9
commit 5e2b63c658
3 changed files with 11 additions and 5 deletions

View File

@ -1,5 +1,10 @@
2011-11-12 Ulrich Drepper <drepper@gmail.com>
* 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.

View File

@ -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 <isamu@yamato.ibm.com>.
@ -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)

View File

@ -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 <isamu@yamato.ibm.com>.
@ -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 <locale/weight.h>
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