regexp: Hide debugging code behind DEBUG_REGEXP
xmlRegexpPrint is now a deprecated no-op.
diff --git a/include/libxml/xmlregexp.h b/include/libxml/xmlregexp.h
index edbdc98..f7e10c3 100644
--- a/include/libxml/xmlregexp.h
+++ b/include/libxml/xmlregexp.h
@@ -47,6 +47,7 @@
XMLPUBFUN int
xmlRegexpExec (xmlRegexpPtr comp,
const xmlChar *value);
+XML_DEPRECATED
XMLPUBFUN void
xmlRegexpPrint (FILE *output,
xmlRegexpPtr regexp);
diff --git a/python/generator.py b/python/generator.py
index 6b3edca..49e7af5 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -381,6 +381,7 @@
'xmlRecoverDoc': True,
'xmlRecoverFile': True,
'xmlRecoverMemory': True,
+ 'xmlRegexpPrint': True,
'xmlRegisterHTTPPostCallbacks': True,
'xmlRelaxNGCleanupTypes': True,
'xmlRelaxNGInitTypes': True,
diff --git a/xmlregexp.c b/xmlregexp.c
index 27ca4d4..da82648 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -37,6 +37,8 @@
#define SIZE_MAX ((size_t) -1)
#endif
+/* #define DEBUG_REGEXP */
+
#define MAX_PUSH 10000000
#ifdef ERROR
@@ -930,6 +932,7 @@
* *
************************************************************************/
+#ifdef DEBUG_REGEXP
static void
xmlRegPrintAtomType(FILE *output, xmlRegAtomType type) {
switch (type) {
@@ -1302,6 +1305,42 @@
fprintf(output, "%d counters:\n", 0);
}
+static void
+xmlRegexpPrintInternal(FILE *output, xmlRegexpPtr regexp) {
+ int i;
+
+ if (output == NULL)
+ return;
+ fprintf(output, " regexp: ");
+ if (regexp == NULL) {
+ fprintf(output, "NULL\n");
+ return;
+ }
+ if (regexp->compact) {
+ xmlRegPrintCompact(output, regexp);
+ return;
+ }
+
+ fprintf(output, "'%s' ", regexp->string);
+ fprintf(output, "\n");
+ fprintf(output, "%d atoms:\n", regexp->nbAtoms);
+ for (i = 0;i < regexp->nbAtoms; i++) {
+ fprintf(output, " %02d ", i);
+ xmlRegPrintAtom(output, regexp->atoms[i]);
+ }
+ fprintf(output, "%d states:", regexp->nbStates);
+ fprintf(output, "\n");
+ for (i = 0;i < regexp->nbStates; i++) {
+ xmlRegPrintState(output, regexp->states[i]);
+ }
+ fprintf(output, "%d counters:\n", regexp->nbCounters);
+ for (i = 0;i < regexp->nbCounters; i++) {
+ fprintf(output, " %d: min %d max %d\n", i, regexp->counters[i].min,
+ regexp->counters[i].max);
+ }
+}
+#endif /* DEBUG_REGEXP */
+
/************************************************************************
* *
* Finite Automata structures manipulations *
@@ -5359,41 +5398,13 @@
* @output: the file for the output debug
* @regexp: the compiled regexp
*
- * Print the content of the compiled regular expression
+ * DEPRECATED: Don't use.
+ *
+ * No-op since 2.14.0.
*/
void
-xmlRegexpPrint(FILE *output, xmlRegexpPtr regexp) {
- int i;
-
- if (output == NULL)
- return;
- fprintf(output, " regexp: ");
- if (regexp == NULL) {
- fprintf(output, "NULL\n");
- return;
- }
- if (regexp->compact) {
- xmlRegPrintCompact(output, regexp);
- return;
- }
-
- fprintf(output, "'%s' ", regexp->string);
- fprintf(output, "\n");
- fprintf(output, "%d atoms:\n", regexp->nbAtoms);
- for (i = 0;i < regexp->nbAtoms; i++) {
- fprintf(output, " %02d ", i);
- xmlRegPrintAtom(output, regexp->atoms[i]);
- }
- fprintf(output, "%d states:", regexp->nbStates);
- fprintf(output, "\n");
- for (i = 0;i < regexp->nbStates; i++) {
- xmlRegPrintState(output, regexp->states[i]);
- }
- fprintf(output, "%d counters:\n", regexp->nbCounters);
- for (i = 0;i < regexp->nbCounters; i++) {
- fprintf(output, " %d: min %d max %d\n", i, regexp->counters[i].min,
- regexp->counters[i].max);
- }
+xmlRegexpPrint(FILE *output ATTRIBUTE_UNUSED,
+ xmlRegexpPtr regexp ATTRIBUTE_UNUSED) {
}
/**