parser: Convert inputPush and inputPop to macros
diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml
index 8ace68e..4590003 100644
--- a/doc/libxml2-api.xml
+++ b/doc/libxml2-api.xml
@@ -829,12 +829,12 @@
<exports symbol='XML_SUBSTITUTE_NONE' type='macro'/>
<exports symbol='XML_SUBSTITUTE_PEREF' type='macro'/>
<exports symbol='XML_SUBSTITUTE_REF' type='macro'/>
+ <exports symbol='inputPop' type='macro'/>
+ <exports symbol='inputPush' type='macro'/>
<exports symbol='xmlParserMaxDepth' type='variable'/>
<exports symbol='xmlStringComment' type='variable'/>
<exports symbol='xmlStringText' type='variable'/>
<exports symbol='xmlStringTextNoenc' type='variable'/>
- <exports symbol='inputPop' type='function'/>
- <exports symbol='inputPush' type='function'/>
<exports symbol='xmlCheckLanguageID' type='function'/>
<exports symbol='xmlCopyChar' type='function'/>
<exports symbol='xmlCopyCharMultiByte' type='function'/>
@@ -4315,6 +4315,10 @@
<info>Returns the attributes required for the specified element.</info>
<arg name='elt' info='HTML element'/>
</macro>
+ <macro name='inputPop' file='parserInternals'>
+ </macro>
+ <macro name='inputPush' file='parserInternals'>
+ </macro>
<macro name='isolat1ToUTF8' file='encoding'>
</macro>
<macro name='xmlChildrenNode' file='tree'>
@@ -7413,17 +7417,6 @@
<return type='void'/>
<arg name='handler' type='xmlGenericErrorFunc *' info='the handler'/>
</function>
- <function name='inputPop' file='parserInternals' module='parser'>
- <info>Pops the top parser input from the input stack</info>
- <return type='xmlParserInputPtr' info='the input just removed'/>
- <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
- </function>
- <function name='inputPush' file='parserInternals' module='parser'>
- <info>Pushes a new parser input on top of the input stack</info>
- <return type='int' info='-1 in case of error, the index in the stack otherwise'/>
- <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
- <arg name='value' type='xmlParserInputPtr' info='the parser input'/>
- </function>
<functype name='internalSubsetSAXFunc' file='parser' module='parser'>
<info>Callback on internal subset declaration.</info>
<return type='void'/>
diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h
index f2748b7..1c0699d 100644
--- a/include/libxml/parserInternals.h
+++ b/include/libxml/parserInternals.h
@@ -22,6 +22,12 @@
extern "C" {
#endif
+/*
+ * Backward compatibility
+ */
+#define inputPush xmlCtxtPushInput
+#define inputPop xmlCtxtPopInput
+
/**
* xmlParserMaxDepth:
*
@@ -559,13 +565,6 @@
xmlChar end3);
/*
- * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
- */
-XMLPUBFUN int inputPush (xmlParserCtxtPtr ctxt,
- xmlParserInputPtr value);
-XMLPUBFUN xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
-
-/*
* other commodities shared between parser.c and parserInternals.
*/
XML_DEPRECATED
diff --git a/parser.c b/parser.c
index fa16b54..81b7e67 100644
--- a/parser.c
+++ b/parser.c
@@ -2049,33 +2049,6 @@
}
/**
- * inputPush:
- * @ctxt: an XML parser context
- * @value: the parser input
- *
- * Pushes a new parser input on top of the input stack
- *
- * Returns -1 in case of error, the index in the stack otherwise
- */
-int
-inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
-{
- return(xmlCtxtPushInput(ctxt, value));
-}
-/**
- * inputPop:
- * @ctxt: an XML parser context
- *
- * Pops the top parser input from the input stack
- *
- * Returns the input just removed
- */
-xmlParserInputPtr
-inputPop(xmlParserCtxtPtr ctxt)
-{
- return(xmlCtxtPopInput(ctxt));
-}
-/**
* nodePush:
* @ctxt: an XML parser context
* @value: the element node
diff --git a/testapi.c b/testapi.c
index bbc14c7..930d413 100644
--- a/testapi.c
+++ b/testapi.c
@@ -15626,77 +15626,6 @@
}
static int
-test_inputPop(void) {
- int test_ret = 0;
-
- int mem_base;
- xmlParserInputPtr ret_val;
- xmlParserCtxtPtr ctxt; /* an XML parser context */
- int n_ctxt;
-
- for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
- mem_base = xmlMemBlocks();
- ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
-
- ret_val = inputPop(ctxt);
- desret_xmlParserInputPtr(ret_val);
- call_tests++;
- des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in inputPop",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_ctxt);
- printf("\n");
- }
- }
- function_tests++;
-
- return(test_ret);
-}
-
-
-static int
-test_inputPush(void) {
- int test_ret = 0;
-
- int mem_base;
- int ret_val;
- xmlParserCtxtPtr ctxt; /* an XML parser context */
- int n_ctxt;
- xmlParserInputPtr value; /* the parser input */
- int n_value;
-
- for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
- for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
- mem_base = xmlMemBlocks();
- ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
- value = gen_xmlParserInputPtr(n_value, 1);
-
- ret_val = inputPush(ctxt, value);
- desret_int(ret_val);
- call_tests++;
- des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
- des_xmlParserInputPtr(n_value, value, 1);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in inputPush",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_ctxt);
- printf(" %d", n_value);
- printf("\n");
- }
- }
- }
- function_tests++;
-
- return(test_ret);
-}
-
-
-static int
test_xmlCheckLanguageID(void) {
int test_ret = 0;
@@ -16826,9 +16755,7 @@
test_parserInternals(void) {
int test_ret = 0;
- if (quiet == 0) printf("Testing parserInternals : 30 of 77 functions ...\n");
- test_ret += test_inputPop();
- test_ret += test_inputPush();
+ if (quiet == 0) printf("Testing parserInternals : 28 of 75 functions ...\n");
test_ret += test_xmlCheckLanguageID();
test_ret += test_xmlCopyChar();
test_ret += test_xmlCopyCharMultiByte();