svn commit: r320750 - head/lib/libc/regex
Kyle Evans
kevans at FreeBSD.org
Thu Jul 6 18:21:32 UTC 2017
Author: kevans
Date: Thu Jul 6 18:21:30 2017
New Revision: 320750
URL: https://svnweb.freebsd.org/changeset/base/320750
Log:
Fix sparc64 libc build after r320742.
p_branch_empty was declared but never used due to an oversight. Use it as
designed, further comment on its return value.
Reported by: Jenkins (head-sparc64)
Reviewed by: emaste
Approved by: emaste (mentor)
MFC with: r320742
Differential Revision: https://reviews.freebsd.org/D11506
Modified:
head/lib/libc/regex/regcomp.c
Modified: head/lib/libc/regex/regcomp.c
==============================================================================
--- head/lib/libc/regex/regcomp.c Thu Jul 6 18:08:38 2017 (r320749)
+++ head/lib/libc/regex/regcomp.c Thu Jul 6 18:21:30 2017 (r320750)
@@ -114,7 +114,7 @@ static void p_str(struct parse *p);
static int p_branch_eat_delim(struct parse *p, struct branchc *bc);
static void p_branch_ins_offset(struct parse *p, struct branchc *bc);
static void p_branch_fix_tail(struct parse *p, struct branchc *bc);
-static void p_branch_empty(struct parse *p, struct branchc *bc);
+static bool p_branch_empty(struct parse *p, struct branchc *bc);
static bool p_branch_do(struct parse *p, struct branchc *bc);
static void p_bre_pre_parse(struct parse *p, struct branchc *bc);
static void p_bre_post_parse(struct parse *p, struct branchc *bc);
@@ -578,13 +578,15 @@ p_branch_fix_tail(struct parse *p, struct branchc *bc)
/*
* Signal to the parser that an empty branch has been encountered; this will,
* in the future, be used to allow for more permissive behavior with empty
- * branches.
+ * branches. The return value should indicate whether parsing may continue
+ * or not.
*/
-static void
+static bool
p_branch_empty(struct parse *p, struct branchc *bc)
{
SETERROR(REG_EMPTY);
+ return (false);
}
/*
@@ -600,7 +602,13 @@ p_branch_do(struct parse *p, struct branchc *bc)
ate = p_branch_eat_delim(p, bc);
if (ate == 0)
return (false);
- (void)REQUIRE(ate == 1 && (!bc->outer || MORE()), REG_EMPTY);
+ else if ((ate > 1 || (bc->outer && !MORE())) && !p_branch_empty(p, bc))
+ /*
+ * Halt parsing only if we have an empty branch and p_branch_empty
+ * indicates that we must not continue. In the future, this will not
+ * necessarily be an error.
+ */
+ return (false);
p_branch_ins_offset(p, bc);
return (true);
More information about the svn-src-all
mailing list