diff options
Diffstat (limited to 'gl/regexec.c')
| -rw-r--r-- | gl/regexec.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gl/regexec.c b/gl/regexec.c index 9f065dfa..0d14ac35 100644 --- a/gl/regexec.c +++ b/gl/regexec.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Extended regular expression matching and search library. | 1 | /* Extended regular expression matching and search library. |
| 2 | Copyright (C) 2002-2024 Free Software Foundation, Inc. | 2 | Copyright (C) 2002-2025 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
| 4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. | 4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. |
| 5 | 5 | ||
| @@ -185,7 +185,7 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len); | |||
| 185 | 185 | ||
| 186 | int | 186 | int |
| 187 | regexec (const regex_t *__restrict preg, const char *__restrict string, | 187 | regexec (const regex_t *__restrict preg, const char *__restrict string, |
| 188 | size_t nmatch, regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags) | 188 | size_t nmatch, regmatch_t pmatch[], int eflags) |
| 189 | { | 189 | { |
| 190 | reg_errcode_t err; | 190 | reg_errcode_t err; |
| 191 | Idx start, length; | 191 | Idx start, length; |
| @@ -229,7 +229,7 @@ int | |||
| 229 | attribute_compat_text_section | 229 | attribute_compat_text_section |
| 230 | __compat_regexec (const regex_t *__restrict preg, | 230 | __compat_regexec (const regex_t *__restrict preg, |
| 231 | const char *__restrict string, size_t nmatch, | 231 | const char *__restrict string, size_t nmatch, |
| 232 | regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags) | 232 | regmatch_t pmatch[], int eflags) |
| 233 | { | 233 | { |
| 234 | return regexec (preg, string, nmatch, pmatch, | 234 | return regexec (preg, string, nmatch, pmatch, |
| 235 | eflags & (REG_NOTBOL | REG_NOTEOL)); | 235 | eflags & (REG_NOTBOL | REG_NOTEOL)); |
| @@ -2271,7 +2271,7 @@ merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx, | |||
| 2271 | these destinations and the results of the transition table. */ | 2271 | these destinations and the results of the transition table. */ |
| 2272 | pstate = mctx->state_log[cur_idx]; | 2272 | pstate = mctx->state_log[cur_idx]; |
| 2273 | log_nodes = pstate->entrance_nodes; | 2273 | log_nodes = pstate->entrance_nodes; |
| 2274 | if (next_state != NULL) | 2274 | if (next_state != NULL && next_state->entrance_nodes != NULL) |
| 2275 | { | 2275 | { |
| 2276 | table_nodes = next_state->entrance_nodes; | 2276 | table_nodes = next_state->entrance_nodes; |
| 2277 | *err = re_node_set_init_union (&next_nodes, table_nodes, | 2277 | *err = re_node_set_init_union (&next_nodes, table_nodes, |
| @@ -2721,8 +2721,8 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx) | |||
| 2721 | continue; /* No. */ | 2721 | continue; /* No. */ |
| 2722 | if (sub_top->path == NULL) | 2722 | if (sub_top->path == NULL) |
| 2723 | { | 2723 | { |
| 2724 | sub_top->path = calloc (sizeof (state_array_t), | 2724 | sub_top->path = calloc (sl_str - sub_top->str_idx + 1, |
| 2725 | sl_str - sub_top->str_idx + 1); | 2725 | sizeof (state_array_t)); |
| 2726 | if (sub_top->path == NULL) | 2726 | if (sub_top->path == NULL) |
| 2727 | return REG_ESPACE; | 2727 | return REG_ESPACE; |
| 2728 | } | 2728 | } |
| @@ -3266,7 +3266,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) | |||
| 3266 | if (ndests == 0) | 3266 | if (ndests == 0) |
| 3267 | { | 3267 | { |
| 3268 | state->trtable = (re_dfastate_t **) | 3268 | state->trtable = (re_dfastate_t **) |
| 3269 | calloc (sizeof (re_dfastate_t *), SBC_MAX); | 3269 | calloc (SBC_MAX, sizeof (re_dfastate_t *)); |
| 3270 | if (__glibc_unlikely (state->trtable == NULL)) | 3270 | if (__glibc_unlikely (state->trtable == NULL)) |
| 3271 | return false; | 3271 | return false; |
| 3272 | return true; | 3272 | return true; |
| @@ -3338,7 +3338,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) | |||
| 3338 | discern by looking at the character code: allocate a | 3338 | discern by looking at the character code: allocate a |
| 3339 | 256-entry transition table. */ | 3339 | 256-entry transition table. */ |
| 3340 | trtable = state->trtable = | 3340 | trtable = state->trtable = |
| 3341 | (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX); | 3341 | (re_dfastate_t **) calloc (SBC_MAX, sizeof (re_dfastate_t *)); |
| 3342 | if (__glibc_unlikely (trtable == NULL)) | 3342 | if (__glibc_unlikely (trtable == NULL)) |
| 3343 | goto out_free; | 3343 | goto out_free; |
| 3344 | 3344 | ||
| @@ -3369,7 +3369,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) | |||
| 3369 | transition tables, one starting at trtable[0] and one | 3369 | transition tables, one starting at trtable[0] and one |
| 3370 | starting at trtable[SBC_MAX]. */ | 3370 | starting at trtable[SBC_MAX]. */ |
| 3371 | trtable = state->word_trtable = | 3371 | trtable = state->word_trtable = |
| 3372 | (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), 2 * SBC_MAX); | 3372 | (re_dfastate_t **) calloc (2 * SBC_MAX, sizeof (re_dfastate_t *)); |
| 3373 | if (__glibc_unlikely (trtable == NULL)) | 3373 | if (__glibc_unlikely (trtable == NULL)) |
| 3374 | goto out_free; | 3374 | goto out_free; |
| 3375 | 3375 | ||
