mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
adding xmlMemBlocks() work on generator of an automatic API regression
* xmlmemory.c include/libxml/xmlmemory.h: adding xmlMemBlocks() * Makefile.am gentest.py testapi.c: work on generator of an automatic API regression test tool. * SAX2.c nanoftp.c parser.c parserInternals.c tree.c xmlIO.c xmlstring.c: various API hardeing changes as a result of running teh first set of automatic API regression tests. * test/slashdot16.xml: apparently missing from CVS, commited it Daniel
This commit is contained in:
47
parser.c
47
parser.c
@@ -949,6 +949,8 @@ mem_error:
|
||||
int
|
||||
inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
|
||||
{
|
||||
if ((ctxt == NULL) || (value == NULL))
|
||||
return(0);
|
||||
if (ctxt->inputNr >= ctxt->inputMax) {
|
||||
ctxt->inputMax *= 2;
|
||||
ctxt->inputTab =
|
||||
@@ -977,6 +979,8 @@ inputPop(xmlParserCtxtPtr ctxt)
|
||||
{
|
||||
xmlParserInputPtr ret;
|
||||
|
||||
if (ctxt == NULL)
|
||||
return(NULL);
|
||||
if (ctxt->inputNr <= 0)
|
||||
return (0);
|
||||
ctxt->inputNr--;
|
||||
@@ -8541,6 +8545,9 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
|
||||
|
||||
xmlInitParser();
|
||||
|
||||
if ((ctxt == NULL) || (ctxt->input == NULL))
|
||||
return(-1);
|
||||
|
||||
GROW;
|
||||
|
||||
/*
|
||||
@@ -8700,6 +8707,9 @@ xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) {
|
||||
xmlChar start[4];
|
||||
xmlCharEncoding enc;
|
||||
|
||||
if ((ctxt == NULL) || (ctxt->input == NULL))
|
||||
return(-1);
|
||||
|
||||
xmlDefaultSAXHandlerInit();
|
||||
|
||||
xmlDetectSAX2(ctxt);
|
||||
@@ -8942,6 +8952,9 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
xmlChar cur, next;
|
||||
const xmlChar *lastlt, *lastgt;
|
||||
|
||||
if (ctxt->input == NULL)
|
||||
return(0);
|
||||
|
||||
#ifdef DEBUG_PUSH
|
||||
switch (ctxt->instate) {
|
||||
case XML_PARSER_EOF:
|
||||
@@ -9801,6 +9814,8 @@ done:
|
||||
int
|
||||
xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
|
||||
int terminate) {
|
||||
if (ctxt == NULL)
|
||||
return(XML_ERR_INTERNAL_ERROR);
|
||||
if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1))
|
||||
return(ctxt->errNo);
|
||||
if (ctxt->instate == XML_PARSER_START)
|
||||
@@ -9849,13 +9864,16 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
|
||||
/*
|
||||
* Check for termination
|
||||
*/
|
||||
int avail = 0;
|
||||
int avail = 0;
|
||||
|
||||
if (ctxt->input != NULL) {
|
||||
if (ctxt->input->buf == NULL)
|
||||
avail = ctxt->input->length -
|
||||
(ctxt->input->cur - ctxt->input->base);
|
||||
else
|
||||
avail = ctxt->input->buf->buffer->use -
|
||||
(ctxt->input->cur - ctxt->input->base);
|
||||
avail = ctxt->input->length -
|
||||
(ctxt->input->cur - ctxt->input->base);
|
||||
else
|
||||
avail = ctxt->input->buf->buffer->use -
|
||||
(ctxt->input->cur - ctxt->input->base);
|
||||
}
|
||||
|
||||
if ((ctxt->instate != XML_PARSER_EOF) &&
|
||||
(ctxt->instate != XML_PARSER_EPILOG)) {
|
||||
@@ -11638,10 +11656,13 @@ xmlSetupParserForBuffer(xmlParserCtxtPtr ctxt, const xmlChar* buffer,
|
||||
{
|
||||
xmlParserInputPtr input;
|
||||
|
||||
if ((ctxt == NULL) || (buffer == NULL))
|
||||
return;
|
||||
|
||||
input = xmlNewInputStream(ctxt);
|
||||
if (input == NULL) {
|
||||
xmlErrMemory(NULL, "parsing new buffer: out of memory\n");
|
||||
xmlFree(ctxt);
|
||||
xmlClearParserCtxt(ctxt);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12093,6 +12114,9 @@ xmlCleanupParser(void) {
|
||||
xmlCleanupInputCallbacks();
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
xmlCleanupOutputCallbacks();
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
xmlSchemaCleanupTypes();
|
||||
#endif
|
||||
xmlCleanupGlobals();
|
||||
xmlResetLastError();
|
||||
@@ -12129,7 +12153,12 @@ void
|
||||
xmlCtxtReset(xmlParserCtxtPtr ctxt)
|
||||
{
|
||||
xmlParserInputPtr input;
|
||||
xmlDictPtr dict = ctxt->dict;
|
||||
xmlDictPtr dict;
|
||||
|
||||
if (ctxt == NULL)
|
||||
return;
|
||||
|
||||
dict = ctxt->dict;
|
||||
|
||||
while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
|
||||
xmlFreeInputStream(input);
|
||||
@@ -12325,6 +12354,8 @@ xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk,
|
||||
int
|
||||
xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options)
|
||||
{
|
||||
if (ctxt == NULL)
|
||||
return(-1);
|
||||
if (options & XML_PARSE_RECOVER) {
|
||||
ctxt->recovery = 1;
|
||||
options -= XML_PARSE_RECOVER;
|
||||
|
Reference in New Issue
Block a user