summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-04-29 10:47:44 -0600
committerKarl Williamson <khw@cpan.org>2020-04-29 13:10:11 -0600
commit28601d809e9116df25d4e9a091f21ecf73a1c87a (patch)
treec6f2b29f0b6fbe987c0ffa5fe71ff4e216add7a5 /regcomp.c
parent1c94b0031687aaffc9787970b927805927b3aa65 (diff)
downloadperl-28601d809e9116df25d4e9a091f21ecf73a1c87a.tar.gz
regcomp.c: Add comments
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index 6582a196d6..a4c7331f70 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -21491,7 +21491,9 @@ SV *
Perl_re_intuit_string(pTHX_ REGEXP * const r)
{ /* Assume that RE_INTUIT is set */
/* Returns an SV containing a string that must appear in the target for it
- * to match */
+ * to match, or NULL if nothing is known that must match.
+ *
+ * CAUTION: the SV can be freed during execution of the regex engine */
struct regexp *const prog = ReANY(r);
DECLARE_AND_GET_RE_DEBUG_FLAGS;
@@ -25078,6 +25080,12 @@ S_handle_names_wildcard(pTHX_ const char * wname, /* wildcard name to match */
/* Compile the subpattern consisting of the name being looked for */
subpattern_re = compile_wildcard(wname, wname_len, FALSE /* /-i */ );
must = re_intuit_string(subpattern_re);
+
+ /* (Note: 'must' could contain a NUL. And yet we use strspn() below on it.
+ * This works because the NUL causes the function to return early, thus
+ * showing that there are characters in it other than the acceptable ones,
+ * which is our desired result.) */
+
prog = ReANY(subpattern_re);
/* If only nothing is matched, skip to where empty names are looked for */