Skip to content

Commit 28601d8

Browse files
committed
regcomp.c: Add comments
1 parent 1c94b00 commit 28601d8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

regcomp.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21491,7 +21491,9 @@ SV *
2149121491
Perl_re_intuit_string(pTHX_ REGEXP * const r)
2149221492
{ /* Assume that RE_INTUIT is set */
2149321493
/* Returns an SV containing a string that must appear in the target for it
21494-
* to match */
21494+
* to match, or NULL if nothing is known that must match.
21495+
*
21496+
* CAUTION: the SV can be freed during execution of the regex engine */
2149521497

2149621498
struct regexp *const prog = ReANY(r);
2149721499
DECLARE_AND_GET_RE_DEBUG_FLAGS;
@@ -25078,6 +25080,12 @@ S_handle_names_wildcard(pTHX_ const char * wname, /* wildcard name to match */
2507825080
/* Compile the subpattern consisting of the name being looked for */
2507925081
subpattern_re = compile_wildcard(wname, wname_len, FALSE /* /-i */ );
2508025082
must = re_intuit_string(subpattern_re);
25083+
25084+
/* (Note: 'must' could contain a NUL. And yet we use strspn() below on it.
25085+
* This works because the NUL causes the function to return early, thus
25086+
* showing that there are characters in it other than the acceptable ones,
25087+
* which is our desired result.) */
25088+
2508125089
prog = ReANY(subpattern_re);
2508225090

2508325091
/* If only nothing is matched, skip to where empty names are looked for */

0 commit comments

Comments
 (0)