mirror of
https://sourceware.org/git/glibc.git
synced 2025-06-05 00:22:17 +03:00
Fix a few more cases of ignored return values in regex.
This commit is contained in:
parent
635bc2a20f
commit
2da42bc065
@ -1,5 +1,9 @@
|
||||
2010-01-15 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* posix/regcomp.c: Fix a few more cases of ignored return values.
|
||||
* posix/regex_internal.c: Likewise.
|
||||
* posix/regexec.c: Likewise.
|
||||
|
||||
* include/features.h: _XOPEN_SOURCE_EXTENDED is not defined to be
|
||||
used without _XOPEN_SOURCE. Don't base any decisions on this macro
|
||||
if _XOPEN_SOURCE is not defined as well.
|
||||
@ -13,7 +17,7 @@
|
||||
* elf/elf.h (EF_S390_HIGH_GPRS): Added macro definition for the
|
||||
new elf header flag.
|
||||
|
||||
XS2010-01-13 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
|
||||
2010-01-13 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
|
||||
|
||||
* elf/dl-sysdep.c (_dl_sysdep_start): Added the auxv parameter to
|
||||
dl_main.
|
||||
|
@ -999,7 +999,11 @@ create_initial_state (re_dfa_t *dfa)
|
||||
int dest_idx = dfa->edests[node_idx].elems[0];
|
||||
if (!re_node_set_contains (&init_nodes, dest_idx))
|
||||
{
|
||||
re_node_set_merge (&init_nodes, dfa->eclosures + dest_idx);
|
||||
reg_errcode_t err = re_node_set_merge (&init_nodes,
|
||||
dfa->eclosures
|
||||
+ dest_idx);
|
||||
if (err != REG_NOERROR)
|
||||
return err;
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
@ -1414,7 +1418,7 @@ link_nfa_nodes (void *extra, bin_tree_t *node)
|
||||
case OP_BACK_REF:
|
||||
dfa->nexts[idx] = node->next->node_idx;
|
||||
if (node->token.type == OP_BACK_REF)
|
||||
re_node_set_init_1 (dfa->edests + idx, dfa->nexts[idx]);
|
||||
err = re_node_set_init_1 (dfa->edests + idx, dfa->nexts[idx]);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1690,7 +1694,9 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root)
|
||||
else
|
||||
eclosure_elem = dfa->eclosures[edest];
|
||||
/* Merge the epsilon closure of `edest'. */
|
||||
re_node_set_merge (&eclosure, &eclosure_elem);
|
||||
err = re_node_set_merge (&eclosure, &eclosure_elem);
|
||||
if (BE (err != REG_NOERROR, 0))
|
||||
return err;
|
||||
/* If the epsilon closure of `edest' is incomplete,
|
||||
the epsilon closure of this node is also incomplete. */
|
||||
if (dfa->eclosures[edest].nelem == 0)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Extended regular expression matching and search library.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2006, 2010 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
|
||||
|
||||
@ -36,7 +36,7 @@ static re_dfastate_t *create_cd_newstate (const re_dfa_t *dfa,
|
||||
re_string_reconstruct before using the object. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_string_allocate (re_string_t *pstr, const char *str, int len, int init_len,
|
||||
RE_TRANSLATE_TYPE trans, int icase, const re_dfa_t *dfa)
|
||||
{
|
||||
@ -64,7 +64,7 @@ re_string_allocate (re_string_t *pstr, const char *str, int len, int init_len,
|
||||
/* This function allocate the buffers, and initialize them. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_string_construct (re_string_t *pstr, const char *str, int len,
|
||||
RE_TRANSLATE_TYPE trans, int icase, const re_dfa_t *dfa)
|
||||
{
|
||||
@ -127,7 +127,7 @@ re_string_construct (re_string_t *pstr, const char *str, int len,
|
||||
/* Helper functions for re_string_allocate, and re_string_construct. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_string_realloc_buffers (re_string_t *pstr, int new_buf_len)
|
||||
{
|
||||
#ifdef RE_ENABLE_I18N
|
||||
@ -260,7 +260,7 @@ build_wcs_buffer (re_string_t *pstr)
|
||||
but for REG_ICASE. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
build_wcs_upper_buffer (re_string_t *pstr)
|
||||
{
|
||||
mbstate_t prev_st;
|
||||
@ -559,7 +559,7 @@ re_string_translate_buffer (re_string_t *pstr)
|
||||
convert to upper case in case of REG_ICASE, apply translation. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
|
||||
{
|
||||
int offset = idx - pstr->raw_mbs_idx;
|
||||
@ -951,7 +951,7 @@ re_string_context_at (const re_string_t *input, int idx, int eflags)
|
||||
/* Functions for set operation. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_node_set_alloc (re_node_set *set, int size)
|
||||
{
|
||||
set->alloc = size;
|
||||
@ -963,7 +963,7 @@ re_node_set_alloc (re_node_set *set, int size)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_node_set_init_1 (re_node_set *set, int elem)
|
||||
{
|
||||
set->alloc = 1;
|
||||
@ -979,7 +979,7 @@ re_node_set_init_1 (re_node_set *set, int elem)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_node_set_init_2 (re_node_set *set, int elem1, int elem2)
|
||||
{
|
||||
set->alloc = 2;
|
||||
@ -1009,7 +1009,7 @@ re_node_set_init_2 (re_node_set *set, int elem1, int elem2)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_node_set_init_copy (re_node_set *dest, const re_node_set *src)
|
||||
{
|
||||
dest->nelem = src->nelem;
|
||||
@ -1034,7 +1034,7 @@ re_node_set_init_copy (re_node_set *dest, const re_node_set *src)
|
||||
Note: We assume dest->elems is NULL, when dest->alloc is 0. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
|
||||
const re_node_set *src2)
|
||||
{
|
||||
@ -1125,7 +1125,7 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
|
||||
DEST. Return value indicate the error code or REG_NOERROR if succeeded. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_node_set_init_union (re_node_set *dest, const re_node_set *src1,
|
||||
const re_node_set *src2)
|
||||
{
|
||||
@ -1178,7 +1178,7 @@ re_node_set_init_union (re_node_set *dest, const re_node_set *src1,
|
||||
DEST. Return value indicate the error code or REG_NOERROR if succeeded. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_node_set_merge (re_node_set *dest, const re_node_set *src)
|
||||
{
|
||||
int is, id, sbase, delta;
|
||||
@ -1261,7 +1261,7 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
|
||||
return -1 if an error is occured, return 1 otherwise. */
|
||||
|
||||
static int
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_node_set_insert (re_node_set *set, int elem)
|
||||
{
|
||||
int idx;
|
||||
@ -1318,7 +1318,7 @@ re_node_set_insert (re_node_set *set, int elem)
|
||||
Return -1 if an error is occured, return 1 otherwise. */
|
||||
|
||||
static int
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_node_set_insert_last (re_node_set *set, int elem)
|
||||
{
|
||||
/* Realloc if we need. */
|
||||
@ -1458,7 +1458,7 @@ calc_state_hash (const re_node_set *nodes, unsigned int context)
|
||||
optimization. */
|
||||
|
||||
static re_dfastate_t *
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa,
|
||||
const re_node_set *nodes)
|
||||
{
|
||||
@ -1502,7 +1502,7 @@ re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa,
|
||||
optimization. */
|
||||
|
||||
static re_dfastate_t *
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa,
|
||||
const re_node_set *nodes, unsigned int context)
|
||||
{
|
||||
@ -1539,6 +1539,7 @@ re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa,
|
||||
indicates the error code if failed. */
|
||||
|
||||
static reg_errcode_t
|
||||
__attribute_warn_unused_result__
|
||||
register_state (const re_dfa_t *dfa, re_dfastate_t *newstate,
|
||||
unsigned int hash)
|
||||
{
|
||||
@ -1554,7 +1555,8 @@ register_state (const re_dfa_t *dfa, re_dfastate_t *newstate,
|
||||
{
|
||||
int elem = newstate->nodes.elems[i];
|
||||
if (!IS_EPSILON_NODE (dfa->nodes[elem].type))
|
||||
re_node_set_insert_last (&newstate->non_eps_nodes, elem);
|
||||
if (re_node_set_insert_last (&newstate->non_eps_nodes, elem) < 0)
|
||||
return REG_ESPACE;
|
||||
}
|
||||
|
||||
spot = dfa->state_table + (hash & dfa->state_hash_mask);
|
||||
@ -1592,7 +1594,7 @@ free_state (re_dfastate_t *state)
|
||||
Return the new state if succeeded, otherwise return NULL. */
|
||||
|
||||
static re_dfastate_t *
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
|
||||
unsigned int hash)
|
||||
{
|
||||
@ -1642,7 +1644,7 @@ create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
|
||||
Return the new state if succeeded, otherwise return NULL. */
|
||||
|
||||
static re_dfastate_t *
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
|
||||
unsigned int context, unsigned int hash)
|
||||
{
|
||||
@ -1691,7 +1693,9 @@ create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
|
||||
free_state (newstate);
|
||||
return NULL;
|
||||
}
|
||||
re_node_set_init_copy (newstate->entrance_nodes, nodes);
|
||||
if (re_node_set_init_copy (newstate->entrance_nodes, nodes)
|
||||
!= REG_NOERROR)
|
||||
return NULL;
|
||||
nctx_nodes = 0;
|
||||
newstate->has_constraint = 1;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Extended regular expression matching and search library.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2005, 2007, 2009, 2010 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
|
||||
|
||||
@ -617,6 +617,7 @@ re_exec (s)
|
||||
(START + RANGE >= 0 && START + RANGE <= LENGTH) */
|
||||
|
||||
static reg_errcode_t
|
||||
__attribute_warn_unused_result__
|
||||
re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
|
||||
eflags)
|
||||
const regex_t *preg;
|
||||
@ -936,6 +937,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
__attribute_warn_unused_result__
|
||||
prune_impossible_nodes (mctx)
|
||||
re_match_context_t *mctx;
|
||||
{
|
||||
@ -1069,7 +1071,7 @@ acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx,
|
||||
index of the buffer. */
|
||||
|
||||
static int
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
check_matching (re_match_context_t *mctx, int fl_longest_match,
|
||||
int *p_match_first)
|
||||
{
|
||||
@ -1342,7 +1344,7 @@ proceed_next_node (const re_match_context_t *mctx, int nregs, regmatch_t *regs,
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
push_fail_stack (struct re_fail_stack_t *fs, int str_idx, int dest_node,
|
||||
int nregs, regmatch_t *regs, re_node_set *eps_via_nodes)
|
||||
{
|
||||
@ -1389,7 +1391,7 @@ pop_fail_stack (struct re_fail_stack_t *fs, int *pidx, int nregs,
|
||||
pmatch[i].rm_so == pmatch[i].rm_eo == -1 for 0 < i < nmatch. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
|
||||
regmatch_t *pmatch, int fl_backtrack)
|
||||
{
|
||||
@ -1643,7 +1645,7 @@ sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx,
|
||||
int str_idx, re_node_set *cur_dest)
|
||||
{
|
||||
@ -1805,7 +1807,7 @@ update_cur_sifted_state (const re_match_context_t *mctx,
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes,
|
||||
const re_node_set *candidates)
|
||||
{
|
||||
@ -1822,8 +1824,12 @@ add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes,
|
||||
if (BE (err != REG_NOERROR, 0))
|
||||
return REG_ESPACE;
|
||||
for (i = 0; i < dest_nodes->nelem; i++)
|
||||
re_node_set_merge (&state->inveclosure,
|
||||
{
|
||||
err = re_node_set_merge (&state->inveclosure,
|
||||
dfa->inveclosures + dest_nodes->elems[i]);
|
||||
if (BE (err != REG_NOERROR, 0))
|
||||
return REG_ESPACE;
|
||||
}
|
||||
}
|
||||
return re_node_set_add_intersect (dest_nodes, candidates,
|
||||
&state->inveclosure);
|
||||
@ -2114,7 +2120,7 @@ check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes,
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx,
|
||||
int str_idx, const re_node_set *candidates)
|
||||
{
|
||||
@ -2244,7 +2250,7 @@ sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx,
|
||||
update the destination of STATE_LOG. */
|
||||
|
||||
static re_dfastate_t *
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
transit_state (reg_errcode_t *err, re_match_context_t *mctx,
|
||||
re_dfastate_t *state)
|
||||
{
|
||||
@ -2669,7 +2675,7 @@ transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes)
|
||||
delay these checking for prune_impossible_nodes(). */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
get_subexp (re_match_context_t *mctx, int bkref_node, int bkref_str_idx)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
@ -2869,7 +2875,7 @@ find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes,
|
||||
Return REG_NOERROR if it can arrive, or REG_NOMATCH otherwise. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
check_arrival (re_match_context_t *mctx, state_array_t *path, int top_node,
|
||||
int top_str, int last_node, int last_str, int type)
|
||||
{
|
||||
@ -3030,7 +3036,7 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, int top_node,
|
||||
Can't we unify them? */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
check_arrival_add_next_nodes (re_match_context_t *mctx, int str_idx,
|
||||
re_node_set *cur_nodes, re_node_set *next_nodes)
|
||||
{
|
||||
@ -3162,7 +3168,7 @@ check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes,
|
||||
problematic append it to DST_NODES. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes,
|
||||
int target, int ex_subexp, int type)
|
||||
{
|
||||
@ -3206,7 +3212,7 @@ check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes,
|
||||
in MCTX->BKREF_ENTS. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes,
|
||||
int cur_str, int subexp_num, int type)
|
||||
{
|
||||
@ -4065,7 +4071,7 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node,
|
||||
/* Extend the buffers, if the buffers have run out. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
extend_buffers (re_match_context_t *mctx)
|
||||
{
|
||||
reg_errcode_t ret;
|
||||
@ -4124,7 +4130,7 @@ extend_buffers (re_match_context_t *mctx)
|
||||
/* Initialize MCTX. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
match_ctx_init (re_match_context_t *mctx, int eflags, int n)
|
||||
{
|
||||
mctx->eflags = eflags;
|
||||
@ -4197,7 +4203,7 @@ match_ctx_free (re_match_context_t *mctx)
|
||||
*/
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
match_ctx_add_entry (re_match_context_t *mctx, int node, int str_idx, int from,
|
||||
int to)
|
||||
{
|
||||
@ -4269,7 +4275,7 @@ search_cur_bkref_entry (const re_match_context_t *mctx, int str_idx)
|
||||
at STR_IDX. */
|
||||
|
||||
static reg_errcode_t
|
||||
internal_function
|
||||
internal_function __attribute_warn_unused_result__
|
||||
match_ctx_add_subtop (re_match_context_t *mctx, int node, int str_idx)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
Loading…
x
Reference in New Issue
Block a user