mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-24 06:50:08 +03:00
parser: Make nodePush, nodePop, namePush, namePop private
This commit is contained in:
parent
0b27097a92
commit
361f7bff92
@ -835,10 +835,6 @@
|
||||
<exports symbol='xmlStringTextNoenc' type='variable'/>
|
||||
<exports symbol='inputPop' type='function'/>
|
||||
<exports symbol='inputPush' type='function'/>
|
||||
<exports symbol='namePop' type='function'/>
|
||||
<exports symbol='namePush' type='function'/>
|
||||
<exports symbol='nodePop' type='function'/>
|
||||
<exports symbol='nodePush' type='function'/>
|
||||
<exports symbol='xmlCheckLanguageID' type='function'/>
|
||||
<exports symbol='xmlCopyChar' type='function'/>
|
||||
<exports symbol='xmlCopyCharMultiByte' type='function'/>
|
||||
@ -7441,28 +7437,6 @@ crash if you try to modify the tree)'/>
|
||||
<return type='int' info='1 if true'/>
|
||||
<arg name='ctx' type='void *' info='the user data (XML parser context)'/>
|
||||
</functype>
|
||||
<function name='namePop' file='parserInternals' module='parser'>
|
||||
<info>DEPRECATED: Internal function, do not use. Pops the top element name from the name stack</info>
|
||||
<return type='const xmlChar *' info='the name just removed'/>
|
||||
<arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
|
||||
</function>
|
||||
<function name='namePush' file='parserInternals' module='parser'>
|
||||
<info>DEPRECATED: Internal function, do not use. Pushes a new element name on top of the name 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='const xmlChar *' info='the element name'/>
|
||||
</function>
|
||||
<function name='nodePop' file='parserInternals' module='parser'>
|
||||
<info>DEPRECATED: Internal function, do not use. Pops the top element node from the node stack</info>
|
||||
<return type='xmlNodePtr' info='the node just removed'/>
|
||||
<arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
|
||||
</function>
|
||||
<function name='nodePush' file='parserInternals' module='parser'>
|
||||
<info>DEPRECATED: Internal function, do not use. Pushes a new element node on top of the node 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='xmlNodePtr' info='the element node'/>
|
||||
</function>
|
||||
<functype name='notationDeclSAXFunc' file='parser' module='parser'>
|
||||
<info>What to do when a notation declaration has been parsed.</info>
|
||||
<return type='void'/>
|
||||
|
@ -561,19 +561,9 @@ XMLPUBFUN xmlChar *
|
||||
/*
|
||||
* Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int nodePush (xmlParserCtxtPtr ctxt,
|
||||
xmlNodePtr value);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlNodePtr nodePop (xmlParserCtxtPtr ctxt);
|
||||
XMLPUBFUN int inputPush (xmlParserCtxtPtr ctxt,
|
||||
xmlParserInputPtr value);
|
||||
XMLPUBFUN xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const xmlChar * namePop (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int namePush (xmlParserCtxtPtr ctxt,
|
||||
const xmlChar *value);
|
||||
|
||||
/*
|
||||
* other commodities shared between parser.c and parserInternals.
|
||||
|
@ -92,6 +92,11 @@ xmlSetDeclaredEncoding(xmlParserCtxtPtr ctxt, xmlChar *encoding);
|
||||
XML_HIDDEN const xmlChar *
|
||||
xmlGetActualEncoding(xmlParserCtxtPtr ctxt);
|
||||
|
||||
XML_HIDDEN int
|
||||
nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value);
|
||||
XML_HIDDEN xmlNodePtr
|
||||
nodePop(xmlParserCtxtPtr ctxt);
|
||||
|
||||
XML_HIDDEN xmlParserNsData *
|
||||
xmlParserNsCreate(void);
|
||||
XML_HIDDEN void
|
||||
|
42
parser.c
42
parser.c
@ -2235,46 +2235,6 @@ nameNsPop(xmlParserCtxtPtr ctxt)
|
||||
}
|
||||
#endif /* LIBXML_PUSH_ENABLED */
|
||||
|
||||
/**
|
||||
* namePush:
|
||||
* @ctxt: an XML parser context
|
||||
* @value: the element name
|
||||
*
|
||||
* DEPRECATED: Internal function, do not use.
|
||||
*
|
||||
* Pushes a new element name on top of the name stack
|
||||
*
|
||||
* Returns -1 in case of error, the index in the stack otherwise
|
||||
*/
|
||||
int
|
||||
namePush(xmlParserCtxtPtr ctxt, const xmlChar * value)
|
||||
{
|
||||
if (ctxt == NULL) return (-1);
|
||||
|
||||
if (ctxt->nameNr >= ctxt->nameMax) {
|
||||
const xmlChar **tmp;
|
||||
int newSize;
|
||||
|
||||
newSize = xmlGrowCapacity(ctxt->nameMax, sizeof(tmp[0]),
|
||||
10, XML_MAX_ITEMS);
|
||||
if (newSize < 0)
|
||||
goto mem_error;
|
||||
|
||||
tmp = xmlRealloc(ctxt->nameTab, newSize * sizeof(tmp[0]));
|
||||
if (tmp == NULL)
|
||||
goto mem_error;
|
||||
ctxt->nameTab = tmp;
|
||||
|
||||
ctxt->nameMax = newSize;
|
||||
}
|
||||
ctxt->nameTab[ctxt->nameNr] = value;
|
||||
ctxt->name = value;
|
||||
return (ctxt->nameNr++);
|
||||
mem_error:
|
||||
xmlErrMemory(ctxt);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* namePop:
|
||||
* @ctxt: an XML parser context
|
||||
@ -2285,7 +2245,7 @@ mem_error:
|
||||
*
|
||||
* Returns the name just removed
|
||||
*/
|
||||
const xmlChar *
|
||||
static const xmlChar *
|
||||
namePop(xmlParserCtxtPtr ctxt)
|
||||
{
|
||||
const xmlChar *ret;
|
||||
|
@ -303,10 +303,6 @@ deprecated_funcs = {
|
||||
'htmlIsBooleanAttr': True,
|
||||
'htmlParseCharRef': True,
|
||||
'htmlParseElement': True,
|
||||
'namePop': True,
|
||||
'namePush': True,
|
||||
'nodePop': True,
|
||||
'nodePush': True,
|
||||
'xmlByteConsumed': True,
|
||||
'xmlCheckFilename': True,
|
||||
'xmlCheckLanguageID': True,
|
||||
|
148
testapi.c
148
testapi.c
@ -15696,148 +15696,6 @@ test_inputPush(void) {
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_namePop(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
int mem_base;
|
||||
const xmlChar * 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 = namePop(ctxt);
|
||||
desret_const_xmlChar_ptr(ret_val);
|
||||
call_tests++;
|
||||
des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in namePop",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_ctxt);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_namePush(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlParserCtxtPtr ctxt; /* an XML parser context */
|
||||
int n_ctxt;
|
||||
const xmlChar * value; /* the element name */
|
||||
int n_value;
|
||||
|
||||
for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
|
||||
for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
|
||||
value = gen_const_xmlChar_ptr(n_value, 1);
|
||||
|
||||
ret_val = namePush(ctxt, value);
|
||||
desret_int(ret_val);
|
||||
call_tests++;
|
||||
des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
|
||||
des_const_xmlChar_ptr(n_value, value, 1);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in namePush",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_ctxt);
|
||||
printf(" %d", n_value);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_nodePop(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
int mem_base;
|
||||
xmlNodePtr 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 = nodePop(ctxt);
|
||||
desret_xmlNodePtr(ret_val);
|
||||
call_tests++;
|
||||
des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in nodePop",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_ctxt);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_nodePush(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlParserCtxtPtr ctxt; /* an XML parser context */
|
||||
int n_ctxt;
|
||||
xmlNodePtr value; /* the element node */
|
||||
int n_value;
|
||||
|
||||
for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
|
||||
for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
|
||||
value = gen_xmlNodePtr(n_value, 1);
|
||||
|
||||
ret_val = nodePush(ctxt, value);
|
||||
desret_int(ret_val);
|
||||
call_tests++;
|
||||
des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
|
||||
des_xmlNodePtr(n_value, value, 1);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in nodePush",
|
||||
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;
|
||||
@ -16968,13 +16826,9 @@ static int
|
||||
test_parserInternals(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
if (quiet == 0) printf("Testing parserInternals : 34 of 81 functions ...\n");
|
||||
if (quiet == 0) printf("Testing parserInternals : 30 of 77 functions ...\n");
|
||||
test_ret += test_inputPop();
|
||||
test_ret += test_inputPush();
|
||||
test_ret += test_namePop();
|
||||
test_ret += test_namePush();
|
||||
test_ret += test_nodePop();
|
||||
test_ret += test_nodePush();
|
||||
test_ret += test_xmlCheckLanguageID();
|
||||
test_ret += test_xmlCopyChar();
|
||||
test_ret += test_xmlCopyCharMultiByte();
|
||||
|
Loading…
x
Reference in New Issue
Block a user