summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-11-12 01:23:45 -0500
committerUlrich Drepper <drepper@gmail.com>2011-11-12 01:23:45 -0500
commit5e2b63c65892e054980570957f533312cfd223c2 (patch)
tree2d9ca65c8bdbd7e502101019708b8c907599a4d7
parente7f4b08ee9b36cc1fdb7d7f72013788a832a9f22 (diff)
downloadglibc-5e2b63c65892e054980570957f533312cfd223c2.tar.gz
Fix warnings in regex
-rw-r--r--ChangeLog5
-rw-r--r--posix/regex_internal.c6
-rw-r--r--posix/regex_internal.h5
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 <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.
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 <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)
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 <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