mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 02:03:35 +08:00
Update.
2002-11-27 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (parse_expression): Set the bit since the back reference is used in the regular expression. * posix/regex_internal.c (re_node_set_init_1): Make it clean in case of malloc failure. (re_node_set_init_copy): Likewise. * posix/regex_internal.h (state_array_t): New structure. (re_sub_match_last_t): Likewise. (re_sub_match_top_t): Likewise. (re_match_context_t): Add new members. (re_dfa_t): Likewise. * posix/regexec.c (re_search_internal): Invoke prune_impossible_nodes to check the matching is really correct, and retry if failed. Move the routin pruning the impossible nodes from here, ... (prune_impossible_nodes): To this function. (check_matching): Invoke check_subexp_matching_top, and replace redundant checking with transit_state_bkref invocation. (proceed_next_node): Replace strncmp with memcmp. Reported by Paolo Bonzini <bonzini@gnu.org>. (update_cur_sifted_state): Remove search_subexp invocation. (search_subexp): Remove this function. (check_dst_limits_calc_pos): Use search_cur_bkref_entry for optimization. (sift_states_bkref): Use search_cur_bkref_entry for optimization. Remove unused invocation of match_ctx_add_entry. (transit_state): Invoke check_subexp_matching_top. (check_subexp_matching_top): New function. (transit_state_bkref): Remove unused array. Merge transit_state_bkref_loop. (transit_state_bkref_loop): Use get_subexp instead of sift_states_backward. Use search_cur_bkref_entry for optimization. Merge this function to transit_state_bkref. (get_subexp): New function. (get_subexp_sub): Likewise. (find_subexp_node): Likewise. (check_arrival): Likewise. (check_arrival_expand_ecl): Likewise. (check_arrival_expand_ecl_sub): Likewise. (expand_bkref_cache): Likewise. (match_ctx_init): Initialize new members. (match_ctx_clean): New function. (match_ctx_free): Release new members. (match_ctx_free_subtops): New function. (match_ctx_add_entry): Fix indent. (search_cur_bkref_entry): New function. (match_ctx_add_subtop): Likewise. (match_ctx_add_sublast): Likewise.
This commit is contained in:
parent
b54e18ebb3
commit
6291ee3c5f
49
ChangeLog
49
ChangeLog
@ -1,3 +1,52 @@
|
||||
2002-11-27 Isamu Hasegawa <isamu@yamato.ibm.com>
|
||||
|
||||
* posix/regcomp.c (parse_expression): Set the bit since the back
|
||||
reference is used in the regular expression.
|
||||
* posix/regex_internal.c (re_node_set_init_1): Make it clean in case
|
||||
of malloc failure.
|
||||
(re_node_set_init_copy): Likewise.
|
||||
* posix/regex_internal.h (state_array_t): New structure.
|
||||
(re_sub_match_last_t): Likewise.
|
||||
(re_sub_match_top_t): Likewise.
|
||||
(re_match_context_t): Add new members.
|
||||
(re_dfa_t): Likewise.
|
||||
* posix/regexec.c (re_search_internal): Invoke prune_impossible_nodes
|
||||
to check the matching is really correct, and retry if failed.
|
||||
Move the routin pruning the impossible nodes from here, ...
|
||||
(prune_impossible_nodes): To this function.
|
||||
(check_matching): Invoke check_subexp_matching_top, and replace
|
||||
redundant checking with transit_state_bkref invocation.
|
||||
(proceed_next_node): Replace strncmp with memcmp. Reported by
|
||||
Paolo Bonzini <bonzini@gnu.org>.
|
||||
(update_cur_sifted_state): Remove search_subexp invocation.
|
||||
(search_subexp): Remove this function.
|
||||
(check_dst_limits_calc_pos): Use search_cur_bkref_entry for
|
||||
optimization.
|
||||
(sift_states_bkref): Use search_cur_bkref_entry for optimization.
|
||||
Remove unused invocation of match_ctx_add_entry.
|
||||
(transit_state): Invoke check_subexp_matching_top.
|
||||
(check_subexp_matching_top): New function.
|
||||
(transit_state_bkref): Remove unused array.
|
||||
Merge transit_state_bkref_loop.
|
||||
(transit_state_bkref_loop): Use get_subexp instead of
|
||||
sift_states_backward. Use search_cur_bkref_entry for optimization.
|
||||
Merge this function to transit_state_bkref.
|
||||
(get_subexp): New function.
|
||||
(get_subexp_sub): Likewise.
|
||||
(find_subexp_node): Likewise.
|
||||
(check_arrival): Likewise.
|
||||
(check_arrival_expand_ecl): Likewise.
|
||||
(check_arrival_expand_ecl_sub): Likewise.
|
||||
(expand_bkref_cache): Likewise.
|
||||
(match_ctx_init): Initialize new members.
|
||||
(match_ctx_clean): New function.
|
||||
(match_ctx_free): Release new members.
|
||||
(match_ctx_free_subtops): New function.
|
||||
(match_ctx_add_entry): Fix indent.
|
||||
(search_cur_bkref_entry): New function.
|
||||
(match_ctx_add_subtop): Likewise.
|
||||
(match_ctx_add_sublast): Likewise.
|
||||
|
||||
2002-11-25 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* iconv/Makefile (tests): Remove tst-iconv4.c
|
||||
|
@ -1,38 +0,0 @@
|
||||
/* Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <pthreadP.h>
|
||||
#include <tls.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
|
||||
int
|
||||
pthread_sigmask (how, newmask, oldmask)
|
||||
int how;
|
||||
const sigset_t *newmask;
|
||||
sigset_t *oldmask;
|
||||
{
|
||||
int result = INTERNAL_SYSCALL (sigprocmask, 3, how, newmask, oldmask);
|
||||
|
||||
return (INTERNAL_SYSCALL_ERROR_P (result)
|
||||
? INTERNAL_SYSCALL_ERRNO (result)
|
||||
: 0);
|
||||
}
|
@ -17,8 +17,10 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <pthreadP.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
|
||||
int
|
||||
@ -40,5 +42,13 @@ pthread_sigmask (how, newmask, oldmask)
|
||||
newmask = &local_newmask;
|
||||
}
|
||||
|
||||
return sigprocmask (how, newmask, oldmask);
|
||||
#ifdef INTERNAL_SYSCALL
|
||||
int result = INTERNAL_SYSCALL (sigprocmask, 3, how, newmask, oldmask);
|
||||
|
||||
return (INTERNAL_SYSCALL_ERROR_P (result)
|
||||
? INTERNAL_SYSCALL_ERRNO (result)
|
||||
: 0);
|
||||
#else
|
||||
return sigprocmask (how, newmask, oldmask) == -1 : errno : 0;
|
||||
#endif
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
#include "../i386/pthread_sigmask.c"
|
@ -1975,6 +1975,7 @@ parse_expression (regexp, preg, token, syntax, nest, err)
|
||||
*err = REG_ESUBREG;
|
||||
return NULL;
|
||||
}
|
||||
dfa->used_bkref_map |= 1 << (token->opr.idx - 1);
|
||||
new_idx = re_dfa_add_node (dfa, *token, 0);
|
||||
tree = create_tree (NULL, NULL, 0, new_idx);
|
||||
if (BE (new_idx == -1 || tree == NULL, 0))
|
||||
|
@ -614,7 +614,10 @@ re_node_set_init_1 (set, elem)
|
||||
set->nelem = 1;
|
||||
set->elems = re_malloc (int, 1);
|
||||
if (BE (set->elems == NULL, 0))
|
||||
return REG_ESPACE;
|
||||
{
|
||||
set->alloc = set->nelem = 0;
|
||||
return REG_ESPACE;
|
||||
}
|
||||
set->elems[0] = elem;
|
||||
return REG_NOERROR;
|
||||
}
|
||||
@ -661,7 +664,10 @@ re_node_set_init_copy (dest, src)
|
||||
dest->alloc = dest->nelem;
|
||||
dest->elems = re_malloc (int, dest->alloc);
|
||||
if (BE (dest->elems == NULL, 0))
|
||||
return REG_ESPACE;
|
||||
{
|
||||
dest->alloc = dest->nelem = 0;
|
||||
return REG_ESPACE;
|
||||
}
|
||||
memcpy (dest->elems, src->elems, src->nelem * sizeof (int));
|
||||
}
|
||||
else
|
||||
|
@ -401,6 +401,39 @@ struct re_state_table_entry
|
||||
re_dfastate_t **array;
|
||||
};
|
||||
|
||||
/* Array type used in re_sub_match_last_t and re_sub_match_top_t. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int next_idx;
|
||||
int alloc;
|
||||
re_dfastate_t **array;
|
||||
} state_array_t;
|
||||
|
||||
/* Store information about the node NODE whose type is OP_CLOSE_SUBEXP. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int node;
|
||||
int str_idx; /* The position NODE match at. */
|
||||
state_array_t path;
|
||||
} re_sub_match_last_t;
|
||||
|
||||
/* Store information about the node NODE whose type is OP_OPEN_SUBEXP.
|
||||
And information about the node, whose type is OP_CLOSE_SUBEXP,
|
||||
corresponding to NODE is stored in LASTS. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int str_idx;
|
||||
int node;
|
||||
int next_last_offset;
|
||||
state_array_t *path;
|
||||
int alasts; /* Allocation size of LASTS. */
|
||||
int nlasts; /* The number of LASTS. */
|
||||
re_sub_match_last_t **lasts;
|
||||
} re_sub_match_top_t;
|
||||
|
||||
struct re_backref_cache_entry
|
||||
{
|
||||
int node;
|
||||
@ -427,6 +460,9 @@ typedef struct
|
||||
int abkref_ents;
|
||||
struct re_backref_cache_entry *bkref_ents;
|
||||
int max_mb_elem_len;
|
||||
int nsub_tops;
|
||||
int asub_tops;
|
||||
re_sub_match_top_t **sub_tops;
|
||||
} re_match_context_t;
|
||||
|
||||
typedef struct
|
||||
@ -484,13 +520,15 @@ struct re_dfa_t
|
||||
int states_alloc;
|
||||
int init_node;
|
||||
int nbackref; /* The number of backreference in this dfa. */
|
||||
/* If this dfa has "multibyte node", which is a backreference or
|
||||
a node which can accept multibyte character or multi character
|
||||
collating element. */
|
||||
/* Bitmap expressing which backreference is used. */
|
||||
unsigned int used_bkref_map;
|
||||
#ifdef DEBUG
|
||||
char* re_str;
|
||||
#endif
|
||||
unsigned int has_plural_match : 1;
|
||||
/* If this dfa has "multibyte node", which is a backreference or
|
||||
a node which can accept multibyte character or multi character
|
||||
collating element. */
|
||||
unsigned int has_mb_node : 1;
|
||||
};
|
||||
typedef struct re_dfa_t re_dfa_t;
|
||||
|
1363
posix/regexec.c
1363
posix/regexec.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user