aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--regcomp.c80
-rw-r--r--regex.h3
-rw-r--r--regex_internal.h20
-rw-r--r--vms/ChangeLog5
-rw-r--r--vms/vms-conf.h1
6 files changed, 55 insertions, 65 deletions
diff --git a/ChangeLog b/ChangeLog
index c2315d38..759941ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2013-08-26 Arnold D. Robbins <arnold@skeeve.com>
+
+ * regcomp.c (parse_dup_op): Remove RE_TOKEN_INIT_BUG code (change of
+ Feb 19 2005) since it's no longer needed.
+
+ * regcomp.c (re_fastmap_iter): Undo addition of volatile from
+ Jan 18 2007; no longer needed and is one less change to have to
+ maintain aginst the upstream.
+
+ * regcomp.c, regex.h, regex_internal.h: Sync with GLIBC.
+
2013-08-22 Arnold D. Robbins <arnold@skeeve.com>
* str_array.c (env_store): If the new value being stored is NULL,
diff --git a/regcomp.c b/regcomp.c
index fd490d02..d61a16b6 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -322,7 +322,7 @@ static void
re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
char *fastmap)
{
- volatile re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
+ re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
int node_cnt;
int icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE));
for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt)
@@ -2547,13 +2547,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
{
bin_tree_t *tree = NULL, *old_tree = NULL;
int i, start, end, start_idx = re_string_cur_idx (regexp);
-#ifndef RE_TOKEN_INIT_BUG
re_token_t start_token = *token;
-#else
- re_token_t start_token;
-
- memcpy ((void *) &start_token, (void *) token, sizeof start_token);
-#endif
if (token->type == OP_OPEN_DUP_NUM)
{
@@ -2853,40 +2847,29 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
/* Local function for parse_bracket_exp used in _LIBC environement.
Seek the collating symbol entry correspondings to NAME.
- Return the index of the symbol in the SYMB_TABLE. */
+ Return the index of the symbol in the SYMB_TABLE,
+ or -1 if not found. */
auto inline int32_t
__attribute ((always_inline))
- seek_collating_symbol_entry (name, name_len)
- const unsigned char *name;
- size_t name_len;
+ seek_collating_symbol_entry (const unsigned char *name, size_t name_len)
{
- int32_t hash = elem_hash ((const char *) name, name_len);
- int32_t elem = hash % table_size;
- if (symb_table[2 * elem] != 0)
- {
- int32_t second = hash % (table_size - 2) + 1;
+ int32_t elem;
- do
- {
- /* First compare the hashing value. */
- if (symb_table[2 * elem] == hash
- /* Compare the length of the name. */
- && name_len == extra[symb_table[2 * elem + 1]]
- /* Compare the name. */
- && memcmp (name, &extra[symb_table[2 * elem + 1] + 1],
- name_len) == 0)
- {
- /* Yep, this is the entry. */
- break;
- }
-
- /* Next entry. */
- elem += second;
- }
- while (symb_table[2 * elem] != 0);
- }
- return elem;
+ for (elem = 0; elem < table_size; elem++)
+ if (symb_table[2 * elem] != 0)
+ {
+ int32_t idx = symb_table[2 * elem + 1];
+ /* Skip the name of collating element name. */
+ idx += 1 + extra[idx];
+ if (/* Compare the length of the name. */
+ name_len == extra[idx]
+ /* Compare the name. */
+ && memcmp (name, &extra[idx + 1], name_len) == 0)
+ /* Yep, this is the entry. */
+ return elem;
+ }
+ return -1;
}
/* Local function for parse_bracket_exp used in _LIBC environment.
@@ -2895,8 +2878,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
auto inline unsigned int
__attribute ((always_inline))
- lookup_collation_sequence_value (br_elem)
- bracket_elem_t *br_elem;
+ lookup_collation_sequence_value (bracket_elem_t *br_elem)
{
if (br_elem->type == SB_CHAR)
{
@@ -2924,7 +2906,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
int32_t elem, idx;
elem = seek_collating_symbol_entry (br_elem->opr.name,
sym_name_len);
- if (symb_table[2 * elem] != 0)
+ if (elem != -1)
{
/* We found the entry. */
idx = symb_table[2 * elem + 1];
@@ -2942,7 +2924,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
/* Return the collation sequence value. */
return *(unsigned int *) (extra + idx);
}
- else if (symb_table[2 * elem] == 0 && sym_name_len == 1)
+ else if (sym_name_len == 1)
{
/* No valid character. Match it as a single byte
character. */
@@ -2964,11 +2946,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
auto inline reg_errcode_t
__attribute ((always_inline))
- build_range_exp (sbcset, mbcset, range_alloc, start_elem, end_elem)
- re_charset_t *mbcset;
- int *range_alloc;
- bitset_t sbcset;
- bracket_elem_t *start_elem, *end_elem;
+ build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc,
+ bracket_elem_t *start_elem, bracket_elem_t *end_elem)
{
unsigned int ch;
uint32_t start_collseq;
@@ -3047,25 +3026,22 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
auto inline reg_errcode_t
__attribute ((always_inline))
- build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name)
- re_charset_t *mbcset;
- int *coll_sym_alloc;
- bitset_t sbcset;
- const unsigned char *name;
+ build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
+ int *coll_sym_alloc, const unsigned char *name)
{
int32_t elem, idx;
size_t name_len = strlen ((const char *) name);
if (nrules != 0)
{
elem = seek_collating_symbol_entry (name, name_len);
- if (symb_table[2 * elem] != 0)
+ if (elem != -1)
{
/* We found the entry. */
idx = symb_table[2 * elem + 1];
/* Skip the name of collating element name. */
idx += 1 + extra[idx];
}
- else if (symb_table[2 * elem] == 0 && name_len == 1)
+ else if (name_len == 1)
{
/* No valid character, treat it as a normal
character. */
diff --git a/regex.h b/regex.h
index ca619ae5..c72079b2 100644
--- a/regex.h
+++ b/regex.h
@@ -1,7 +1,6 @@
/* Definitions for data structures and routines for the regular
expression library.
- Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005,2006,2008,2011
- Free Software Foundation, Inc.
+ Copyright (C) 1985, 1989-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/regex_internal.h b/regex_internal.h
index f7616fd6..45a69655 100644
--- a/regex_internal.h
+++ b/regex_internal.h
@@ -417,7 +417,7 @@ typedef struct re_dfa_t re_dfa_t;
#ifndef _LIBC
# ifdef __i386__
-# define internal_function __attribute ((regparm (3), stdcall))
+# define internal_function __attribute__ ((regparm (3), stdcall))
# else
# define internal_function
# endif
@@ -436,7 +436,7 @@ static void build_upper_buffer (re_string_t *pstr) internal_function;
static void re_string_translate_buffer (re_string_t *pstr) internal_function;
static unsigned int re_string_context_at (const re_string_t *input, int idx,
int eflags)
- internal_function __attribute ((pure));
+ internal_function __attribute__ ((pure));
#endif
#define re_string_peek_byte(pstr, offset) \
((pstr)->mbs[(pstr)->cur_idx + offset])
@@ -726,7 +726,7 @@ typedef struct
/* Inline functions for bitset operation. */
-static inline void
+static void __attribute__ ((unused))
bitset_not (bitset_t set)
{
int bitset_i;
@@ -734,7 +734,7 @@ bitset_not (bitset_t set)
set[bitset_i] = ~set[bitset_i];
}
-static inline void
+static void __attribute__ ((unused))
bitset_merge (bitset_t dest, const bitset_t src)
{
int bitset_i;
@@ -742,7 +742,7 @@ bitset_merge (bitset_t dest, const bitset_t src)
dest[bitset_i] |= src[bitset_i];
}
-static inline void
+static void __attribute__ ((unused))
bitset_mask (bitset_t dest, const bitset_t src)
{
int bitset_i;
@@ -752,8 +752,8 @@ bitset_mask (bitset_t dest, const bitset_t src)
#ifdef RE_ENABLE_I18N
/* Inline functions for re_string. */
-static inline int
-internal_function __attribute ((pure))
+static int
+internal_function __attribute__ ((pure, unused))
re_string_char_size_at (const re_string_t *pstr, int idx)
{
int byte_idx;
@@ -765,8 +765,8 @@ re_string_char_size_at (const re_string_t *pstr, int idx)
return byte_idx;
}
-static inline wint_t
-internal_function __attribute ((pure))
+static wint_t
+internal_function __attribute__ ((pure, unused))
re_string_wchar_at (const re_string_t *pstr, int idx)
{
if (pstr->mb_cur_max == 1)
@@ -776,7 +776,7 @@ re_string_wchar_at (const re_string_t *pstr, int idx)
# ifndef NOT_IN_libc
static int
-internal_function __attribute ((pure))
+internal_function __attribute__ ((pure, unused))
re_string_elem_size_at (const re_string_t *pstr, int idx)
{
# ifdef _LIBC
diff --git a/vms/ChangeLog b/vms/ChangeLog
index 048e2e61..8dc413dd 100644
--- a/vms/ChangeLog
+++ b/vms/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-26 Arnold D. Robbins <arnold@skeeve.com>
+
+ * vms-conf.h (RE_TOKEN_INIT_BUG): Remove define (change of
+ Feb 19 2005) since it's no longer needed.
+
2013-06-03 Arnold D. Robbins <arnold@skeeve.com>
* gawkmisc.c (init_sockets): New dummy function.
diff --git a/vms/vms-conf.h b/vms/vms-conf.h
index d53976f6..84346a8d 100644
--- a/vms/vms-conf.h
+++ b/vms/vms-conf.h
@@ -606,7 +606,6 @@
#endif
/* #define YYDEBUG 0 */
#define NO_MBSUPPORT /* VAX C's preprocessor can't handle mbsupport.h */
-#define RE_TOKEN_INIT_BUG /* regcomp.c */
#endif
/*