"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "support/regex_internal.c" between
gawk-5.0.1.tar.xz and gawk-5.1.0.tar.xz

About: GNU awk - pattern scanning and processing language.

regex_internal.c  (gawk-5.0.1.tar.xz):regex_internal.c  (gawk-5.1.0.tar.xz)
skipping to change at line 213 skipping to change at line 213
a first byte of a multibyte character. a first byte of a multibyte character.
Note that this function assumes PSTR->VALID_LEN elements are already Note that this function assumes PSTR->VALID_LEN elements are already
built and starts from PSTR->VALID_LEN. */ built and starts from PSTR->VALID_LEN. */
static void static void
build_wcs_buffer (re_string_t *pstr) build_wcs_buffer (re_string_t *pstr)
{ {
#ifdef _LIBC #ifdef _LIBC
unsigned char buf[MB_LEN_MAX]; unsigned char buf[MB_LEN_MAX];
assert (MB_LEN_MAX >= pstr->mb_cur_max); DEBUG_ASSERT (MB_LEN_MAX >= pstr->mb_cur_max);
#else #else
unsigned char buf[64]; unsigned char buf[64];
#endif #endif
mbstate_t prev_st; mbstate_t prev_st;
Idx byte_idx, end_idx, remain_len; Idx byte_idx, end_idx, remain_len;
size_t mbclen; size_t mbclen;
/* Build the buffers from pstr->valid_len to either pstr->len or /* Build the buffers from pstr->valid_len to either pstr->len or
pstr->bufs_len. */ pstr->bufs_len. */
end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len; end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len;
skipping to change at line 286 skipping to change at line 286
static reg_errcode_t static reg_errcode_t
__attribute_warn_unused_result__ __attribute_warn_unused_result__
build_wcs_upper_buffer (re_string_t *pstr) build_wcs_upper_buffer (re_string_t *pstr)
{ {
mbstate_t prev_st; mbstate_t prev_st;
Idx src_idx, byte_idx, end_idx, remain_len; Idx src_idx, byte_idx, end_idx, remain_len;
size_t mbclen; size_t mbclen;
#ifdef _LIBC #ifdef _LIBC
char buf[MB_LEN_MAX]; char buf[MB_LEN_MAX];
assert (MB_LEN_MAX >= pstr->mb_cur_max); DEBUG_ASSERT (pstr->mb_cur_max <= MB_LEN_MAX);
#else #else
char buf[64]; char buf[64];
#endif #endif
byte_idx = pstr->valid_len; byte_idx = pstr->valid_len;
end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len; end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len;
/* The following optimization assumes that ASCII characters can be /* The following optimization assumes that ASCII characters can be
mapped to wide characters with a simple cast. */ mapped to wide characters with a simple cast. */
if (! pstr->map_notascii && pstr->trans == NULL && !pstr->offsets_needed) if (! pstr->map_notascii && pstr->trans == NULL && !pstr->offsets_needed)
skipping to change at line 686 skipping to change at line 686
#ifdef RE_ENABLE_I18N #ifdef RE_ENABLE_I18N
if (pstr->mb_cur_max > 1) if (pstr->mb_cur_max > 1)
memmove (pstr->wcs, pstr->wcs + offset, memmove (pstr->wcs, pstr->wcs + offset,
(pstr->valid_len - offset) * sizeof (wint_t)); (pstr->valid_len - offset) * sizeof (wint_t));
#endif /* RE_ENABLE_I18N */ #endif /* RE_ENABLE_I18N */
if (__glibc_unlikely (pstr->mbs_allocated)) if (__glibc_unlikely (pstr->mbs_allocated))
memmove (pstr->mbs, pstr->mbs + offset, memmove (pstr->mbs, pstr->mbs + offset,
pstr->valid_len - offset); pstr->valid_len - offset);
pstr->valid_len -= offset; pstr->valid_len -= offset;
pstr->valid_raw_len -= offset; pstr->valid_raw_len -= offset;
#if defined DEBUG && DEBUG DEBUG_ASSERT (pstr->valid_len > 0);
assert (pstr->valid_len > 0);
#endif
} }
} }
else else
{ {
#ifdef RE_ENABLE_I18N #ifdef RE_ENABLE_I18N
/* No, skip all characters until IDX. */ /* No, skip all characters until IDX. */
Idx prev_valid_len = pstr->valid_len; Idx prev_valid_len = pstr->valid_len;
if (__glibc_unlikely (pstr->offsets_needed)) if (__glibc_unlikely (pstr->offsets_needed))
{ {
skipping to change at line 942 skipping to change at line 940
if (__glibc_unlikely (idx == input->len)) if (__glibc_unlikely (idx == input->len))
return ((eflags & REG_NOTEOL) ? CONTEXT_ENDBUF return ((eflags & REG_NOTEOL) ? CONTEXT_ENDBUF
: CONTEXT_NEWLINE | CONTEXT_ENDBUF); : CONTEXT_NEWLINE | CONTEXT_ENDBUF);
#ifdef RE_ENABLE_I18N #ifdef RE_ENABLE_I18N
if (input->mb_cur_max > 1) if (input->mb_cur_max > 1)
{ {
wint_t wc; wint_t wc;
Idx wc_idx = idx; Idx wc_idx = idx;
while(input->wcs[wc_idx] == WEOF) while(input->wcs[wc_idx] == WEOF)
{ {
#if defined DEBUG && DEBUG DEBUG_ASSERT (wc_idx >= 0);
/* It must not happen. */
assert (wc_idx >= 0);
#endif
--wc_idx; --wc_idx;
if (wc_idx < 0) if (wc_idx < 0)
return input->tip_context; return input->tip_context;
} }
wc = input->wcs[wc_idx]; wc = input->wcs[wc_idx];
if (__glibc_unlikely (input->word_ops_used != 0) if (__glibc_unlikely (input->word_ops_used != 0)
&& IS_WIDE_WORD_CHAR (wc)) && IS_WIDE_WORD_CHAR (wc))
return CONTEXT_WORD; return CONTEXT_WORD;
return (IS_WIDE_NEWLINE (wc) && input->newline_anchor return (IS_WIDE_NEWLINE (wc) && input->newline_anchor
? CONTEXT_NEWLINE : 0); ? CONTEXT_NEWLINE : 0);
skipping to change at line 1311 skipping to change at line 1306
new_elems = re_realloc (set->elems, Idx, set->alloc); new_elems = re_realloc (set->elems, Idx, set->alloc);
if (__glibc_unlikely (new_elems == NULL)) if (__glibc_unlikely (new_elems == NULL))
return false; return false;
set->elems = new_elems; set->elems = new_elems;
} }
/* Move the elements which follows the new element. Test the /* Move the elements which follows the new element. Test the
first element separately to skip a check in the inner loop. */ first element separately to skip a check in the inner loop. */
if (elem < set->elems[0]) if (elem < set->elems[0])
{ {
idx = 0;
for (idx = set->nelem; idx > 0; idx--) for (idx = set->nelem; idx > 0; idx--)
set->elems[idx] = set->elems[idx - 1]; set->elems[idx] = set->elems[idx - 1];
} }
else else
{ {
for (idx = set->nelem; set->elems[idx - 1] > elem; idx--) for (idx = set->nelem; set->elems[idx - 1] > elem; idx--)
set->elems[idx] = set->elems[idx - 1]; set->elems[idx] = set->elems[idx - 1];
} }
/* Insert the new element. */ /* Insert the new element. */
skipping to change at line 1714 skipping to change at line 1708
/* If the state has the halt node, the state is a halt state. */ /* If the state has the halt node, the state is a halt state. */
if (type == END_OF_RE) if (type == END_OF_RE)
newstate->halt = 1; newstate->halt = 1;
else if (type == OP_BACK_REF) else if (type == OP_BACK_REF)
newstate->has_backref = 1; newstate->has_backref = 1;
if (constraint) if (constraint)
{ {
if (newstate->entrance_nodes == &newstate->nodes) if (newstate->entrance_nodes == &newstate->nodes)
{ {
newstate->entrance_nodes = re_malloc (re_node_set, 1); re_node_set *entrance_nodes = re_malloc (re_node_set, 1);
if (__glibc_unlikely (newstate->entrance_nodes == NULL)) if (__glibc_unlikely (entrance_nodes == NULL))
{ {
free_state (newstate); free_state (newstate);
return NULL; return NULL;
} }
newstate->entrance_nodes = entrance_nodes;
if (re_node_set_init_copy (newstate->entrance_nodes, nodes) if (re_node_set_init_copy (newstate->entrance_nodes, nodes)
!= REG_NOERROR) != REG_NOERROR)
return NULL; {
free_state (newstate);
return NULL;
}
nctx_nodes = 0; nctx_nodes = 0;
newstate->has_constraint = 1; newstate->has_constraint = 1;
} }
if (NOT_SATISFY_PREV_CONSTRAINT (constraint,context)) if (NOT_SATISFY_PREV_CONSTRAINT (constraint,context))
{ {
re_node_set_remove_at (&newstate->nodes, i - nctx_nodes); re_node_set_remove_at (&newstate->nodes, i - nctx_nodes);
++nctx_nodes; ++nctx_nodes;
} }
} }
 End of changes. 8 change blocks. 
13 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)