[libxml2] Fix --with-valid --without-regexps build
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Fix --with-valid --without-regexps build
- Date: Fri, 2 Sep 2022 16:52:03 +0000 (UTC)
commit c714979293f3bc49d4a77c9ccbecf4e799642a6b
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Thu Sep 1 23:15:35 2022 +0200
Fix --with-valid --without-regexps build
This build config resulted in segfaults in 'runtest' because a special
xmlElementContentPtr showed up in a few places. I'm not sure if this is
the right fix.
An error message was changed to conform to the --with-regexps build.
There are still a few missing validity errors, so the tests don't pass.
result/VC/ElementValid8 | 2 +-
result/VC/ElementValid8.rdr | 2 +-
valid.c | 18 +++++++++++++-----
3 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/result/VC/ElementValid8 b/result/VC/ElementValid8
index f1b0dada..79626301 100644
--- a/result/VC/ElementValid8
+++ b/result/VC/ElementValid8
@@ -1,3 +1,3 @@
-./test/VC/ElementValid8:7: validity error : Content model of doc is not determinist: ((a , b) | (a , c))
+./test/VC/ElementValid8:7: validity error : Content model of doc is not deterministic: ((a , b) | (a , c))
<doc><a/><c> doc is non-deterministic </c></doc>
^
diff --git a/result/VC/ElementValid8.rdr b/result/VC/ElementValid8.rdr
index f1b0dada..79626301 100644
--- a/result/VC/ElementValid8.rdr
+++ b/result/VC/ElementValid8.rdr
@@ -1,3 +1,3 @@
-./test/VC/ElementValid8:7: validity error : Content model of doc is not determinist: ((a , b) | (a , c))
+./test/VC/ElementValid8:7: validity error : Content model of doc is not deterministic: ((a , b) | (a , c))
<doc><a/><c> doc is non-deterministic </c></doc>
^
diff --git a/valid.c b/valid.c
index dc2d175d..182ffed1 100644
--- a/valid.c
+++ b/valid.c
@@ -835,7 +835,7 @@ xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
xmlSnprintfElementContent(expr, 5000, elem->content, 1);
xmlErrValidNode(ctxt, (xmlNodePtr) elem,
XML_DTD_CONTENT_NOT_DETERMINIST,
- "Content model of %s is not determinist: %s\n",
+ "Content model of %s is not deterministic: %s\n",
elem->name, BAD_CAST expr, NULL);
#ifdef DEBUG_REGEXP_ALGO
xmlRegexpPrint(stderr, elem->contModel);
@@ -4906,6 +4906,7 @@ cont:
*/
if ((CONT != NULL) &&
((CONT->parent == NULL) ||
+ (CONT->parent == (xmlElementContentPtr) 1) ||
(CONT->parent->type != XML_ELEMENT_CONTENT_OR)) &&
((CONT->ocur == XML_ELEMENT_CONTENT_MULT) ||
(CONT->ocur == XML_ELEMENT_CONTENT_OPT) ||
@@ -5158,7 +5159,8 @@ analyze:
* Then act accordingly at the parent level
*/
RESET_OCCURRENCE;
- if (CONT->parent == NULL)
+ if ((CONT->parent == NULL) ||
+ (CONT->parent == (xmlElementContentPtr) 1))
break;
switch (CONT->parent->type) {
@@ -5440,9 +5442,13 @@ fail:
STATE = 0;
ret = xmlValidateElementType(ctxt);
if ((ret == -3) && (warn)) {
- xmlErrValidWarning(ctxt, child, XML_DTD_CONTENT_NOT_DETERMINIST,
- "Content model for Element %s is ambiguous\n",
- name, NULL, NULL);
+ char expr[5000];
+ expr[0] = 0;
+ xmlSnprintfElementContent(expr, 5000, elemDecl->content, 1);
+ xmlErrValidNode(ctxt, (xmlNodePtr) elemDecl,
+ XML_DTD_CONTENT_NOT_DETERMINIST,
+ "Content model of %s is not deterministic: %s\n",
+ name, BAD_CAST expr, NULL);
} else if (ret == -2) {
/*
* An entities reference appeared at this level.
@@ -5663,6 +5669,7 @@ done:
return(ret);
}
+#ifdef LIBXML_REGEXP_ENABLED
/**
* xmlValidateCheckMixed:
* @ctxt: the validation context
@@ -5728,6 +5735,7 @@ xmlValidateCheckMixed(xmlValidCtxtPtr ctxt,
}
return(0);
}
+#endif /* LIBXML_REGEXP_ENABLED */
/**
* xmlValidGetElemDecl:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]