# HG changeset patch # User stephent # Date 1110344371 0 # Node ID cd00e5eeb22a13751e862b39db1007705b35edb0 # Parent 94aad03d0e1edd65b152470fae9d3df3a8e8c19c [xemacs-hg @ 2005-03-09 04:59:25 by stephent] small regex doc patch <876501fmab.fsf@tleepslib.sk.tsukuba.ac.jp> diff -r 94aad03d0e1e -r cd00e5eeb22a src/ChangeLog --- a/src/ChangeLog Tue Mar 08 22:51:29 2005 +0000 +++ b/src/ChangeLog Wed Mar 09 04:59:31 2005 +0000 @@ -1,3 +1,9 @@ +2005-01-13 Stephen J. Turnbull + + * regex.c (re_match_2_internal): + * regex.h (struct re_pattern_buffer): + Improve comments. Add a DEBUG_PRINT2 for null matches. + 2005-03-02 Aidan Kehoe * select-x.c (x_reply_selection_request): Check that diff -r 94aad03d0e1e -r cd00e5eeb22a src/regex.c --- a/src/regex.c Tue Mar 08 22:51:29 2005 +0000 +++ b/src/regex.c Wed Mar 09 04:59:31 2005 +0000 @@ -5178,8 +5178,9 @@ : ((regoff_t) (d - string2 + size1))); } - /* Go through the first `min (num_regs, regs->num_regs)' - registers, since that is all we initialized. */ + /* Map over the NUM_NONSHY_REGS non-shy internal registers. + Copy each into the corresponding external register. + MCNT indexes external registers. */ for (mcnt = 1; mcnt < MIN (num_nonshy_regs, regs->num_regs); mcnt++) { @@ -5198,9 +5199,10 @@ } /* regs && !bufp->no_sub */ /* If we have regs and the regs structure has more elements than - were in the pattern, set the extra elements to -1. If we - (re)allocated the registers, this is the case, because we - always allocate enough to have at least one -1 at the end. + were in the pattern, set the extra elements starting with + NUM_NONSHY_REGS to -1. If we (re)allocated the registers, + this is the case, because we always allocate enough to have + at least one -1 at the end. We do this even when no_sub is set because some applications (XEmacs) reuse register structures which may contain stale @@ -5406,8 +5408,11 @@ p1 = p; /* To send to group_match_null_string_p. */ if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE) - REG_MATCH_NULL_STRING_P (reg_info[*p]) - = group_match_null_string_p (&p1, pend, reg_info); + REG_MATCH_NULL_STRING_P (reg_info[*p]) + = group_match_null_string_p (&p1, pend, reg_info); + + DEBUG_PRINT2 (" group CAN%s match null string\n", + REG_MATCH_NULL_STRING_P (reg_info[*p]) ? "NOT" : ""); /* Save the position in the string where we were the last time we were at this open-group operator in case the group is diff -r 94aad03d0e1e -r cd00e5eeb22a src/regex.h --- a/src/regex.h Tue Mar 08 22:51:29 2005 +0000 +++ b/src/regex.h Wed Mar 09 04:59:31 2005 +0000 @@ -357,8 +357,8 @@ when it is matched. */ RE_TRANSLATE_TYPE translate; - /* Number of returnable groups found by the compiler. (This does - not count shy groups.) */ + /* Number of subpatterns (returnable groups) found by the compiler. + (This does not count shy groups.) */ int re_nsub; /* Total number of groups found by the compiler. (Including