summaryrefslogtreecommitdiffstats
path: root/gl/regex_internal.c
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2009-01-15 09:22:57 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2009-01-15 10:19:08 (GMT)
commit71cdb52799220f8d9052643baf1d3e9836a9c755 (patch)
tree27aee97a35d9ab51f0d8f64a46690bd41a5f8c1b /gl/regex_internal.c
parentf7afa46586645e50498d8b2d0c67884f014dc3a4 (diff)
downloadmonitoring-plugins-71cdb52799220f8d9052643baf1d3e9836a9c755.tar.gz
Sync with gnulib
Diffstat (limited to 'gl/regex_internal.c')
-rw-r--r--gl/regex_internal.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/gl/regex_internal.c b/gl/regex_internal.c
index cf3bf1b..7acec79 100644
--- a/gl/regex_internal.c
+++ b/gl/regex_internal.c
@@ -1,6 +1,6 @@
1/* Extended regular expression matching and search library. 1/* Extended regular expression matching and search library.
2 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software 2 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
3 Foundation, Inc. 3 Free Software Foundation, Inc.
4 This file is part of the GNU C Library. 4 This file is part of the GNU C Library.
5 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. 5 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
6 6
@@ -236,7 +236,7 @@ build_wcs_buffer (re_string_t *pstr)
236 } 236 }
237 else 237 else
238 p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx; 238 p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx;
239 mbclen = mbrtowc (&wc, p, remain_len, &pstr->cur_state); 239 mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state);
240 if (BE (mbclen == (size_t) -2, 0)) 240 if (BE (mbclen == (size_t) -2, 0))
241 { 241 {
242 /* The buffer doesn't have enough space, finish to build. */ 242 /* The buffer doesn't have enough space, finish to build. */
@@ -306,9 +306,9 @@ build_wcs_upper_buffer (re_string_t *pstr)
306 306
307 remain_len = end_idx - byte_idx; 307 remain_len = end_idx - byte_idx;
308 prev_st = pstr->cur_state; 308 prev_st = pstr->cur_state;
309 mbclen = mbrtowc (&wc, 309 mbclen = __mbrtowc (&wc,
310 ((const char *) pstr->raw_mbs + pstr->raw_mbs_idx 310 ((const char *) pstr->raw_mbs + pstr->raw_mbs_idx
311 + byte_idx), remain_len, &pstr->cur_state); 311 + byte_idx), remain_len, &pstr->cur_state);
312 if (BE (mbclen < (size_t) -2, 1)) 312 if (BE (mbclen < (size_t) -2, 1))
313 { 313 {
314 wchar_t wcu = wc; 314 wchar_t wcu = wc;
@@ -376,7 +376,7 @@ build_wcs_upper_buffer (re_string_t *pstr)
376 } 376 }
377 else 377 else
378 p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + src_idx; 378 p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + src_idx;
379 mbclen = mbrtowc (&wc, p, remain_len, &pstr->cur_state); 379 mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state);
380 if (BE (mbclen < (size_t) -2, 1)) 380 if (BE (mbclen < (size_t) -2, 1))
381 { 381 {
382 wchar_t wcu = wc; 382 wchar_t wcu = wc;
@@ -499,8 +499,8 @@ re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, wint_t *last_wc)
499 Idx remain_len; 499 Idx remain_len;
500 remain_len = pstr->len - rawbuf_idx; 500 remain_len = pstr->len - rawbuf_idx;
501 prev_st = pstr->cur_state; 501 prev_st = pstr->cur_state;
502 mbclen = mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx, 502 mbclen = __mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx,
503 remain_len, &pstr->cur_state); 503 remain_len, &pstr->cur_state);
504 if (BE (mbclen == (size_t) -2 || mbclen == (size_t) -1 || mbclen == 0, 0)) 504 if (BE (mbclen == (size_t) -2 || mbclen == (size_t) -1 || mbclen == 0, 0))
505 { 505 {
506 /* We treat these cases as a single byte character. */ 506 /* We treat these cases as a single byte character. */
@@ -687,10 +687,10 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
687 } 687 }
688 else 688 else
689 { 689 {
690#ifdef RE_ENABLE_I18N
690 /* No, skip all characters until IDX. */ 691 /* No, skip all characters until IDX. */
691 Idx prev_valid_len = pstr->valid_len; 692 Idx prev_valid_len = pstr->valid_len;
692 693
693#ifdef RE_ENABLE_I18N
694 if (BE (pstr->offsets_needed, 0)) 694 if (BE (pstr->offsets_needed, 0))
695 { 695 {
696 pstr->len = pstr->raw_len - idx + offset; 696 pstr->len = pstr->raw_len - idx + offset;
@@ -745,8 +745,8 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
745 /* XXX Don't use mbrtowc, we know which conversion 745 /* XXX Don't use mbrtowc, we know which conversion
746 to use (UTF-8 -> UCS4). */ 746 to use (UTF-8 -> UCS4). */
747 memset (&cur_state, 0, sizeof (cur_state)); 747 memset (&cur_state, 0, sizeof (cur_state));
748 mbclen = mbrtowc (&wc2, (const char *) p, mlen, 748 mbclen = __mbrtowc (&wc2, (const char *) p, mlen,
749 &cur_state); 749 &cur_state);
750 if (raw + offset - p <= mbclen 750 if (raw + offset - p <= mbclen
751 && mbclen < (size_t) -2) 751 && mbclen < (size_t) -2)
752 { 752 {
@@ -1689,11 +1689,9 @@ create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
1689 1689
1690 for (i = 0 ; i < nodes->nelem ; i++) 1690 for (i = 0 ; i < nodes->nelem ; i++)
1691 { 1691 {
1692 unsigned int constraint = 0;
1693 re_token_t *node = dfa->nodes + nodes->elems[i]; 1692 re_token_t *node = dfa->nodes + nodes->elems[i];
1694 re_token_type_t type = node->type; 1693 re_token_type_t type = node->type;
1695 if (node->constraint) 1694 unsigned int constraint = node->constraint;
1696 constraint = node->constraint;
1697 1695
1698 if (type == CHARACTER && !constraint) 1696 if (type == CHARACTER && !constraint)
1699 continue; 1697 continue;
@@ -1706,8 +1704,6 @@ create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
1706 newstate->halt = 1; 1704 newstate->halt = 1;
1707 else if (type == OP_BACK_REF) 1705 else if (type == OP_BACK_REF)
1708 newstate->has_backref = 1; 1706 newstate->has_backref = 1;
1709 else if (type == ANCHOR)
1710 constraint = node->opr.ctx_type;
1711 1707
1712 if (constraint) 1708 if (constraint)
1713 { 1709 {