mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(libxml) Cleanups of DEBUG ifdefs
This commit is contained in:
parent
01369d69d1
commit
6abb9348ff
@ -32,9 +32,6 @@
|
||||
# define SIZE_T_MAX ((size_t)-1)
|
||||
#endif /* !SIZE_T_MAX */
|
||||
|
||||
/* #define DEBUG_SAX2 */
|
||||
/* #define DEBUG_SAX2_TREE */
|
||||
|
||||
/**
|
||||
* TODO:
|
||||
*
|
||||
@ -339,11 +336,6 @@ xmlSAX2InternalSubset(void *ctx, const xmlChar *name,
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
xmlDtdPtr dtd;
|
||||
if (ctx == NULL) return;
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2InternalSubset(%s, %s, %s)\n",
|
||||
name, ExternalID, SystemID);
|
||||
#endif
|
||||
|
||||
if (ctxt->myDoc == NULL)
|
||||
return;
|
||||
@ -376,11 +368,6 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
|
||||
{
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
if (ctx == NULL) return;
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2ExternalSubset(%s, %s, %s)\n",
|
||||
name, ExternalID, SystemID);
|
||||
#endif
|
||||
if (((ExternalID != NULL) || (SystemID != NULL)) &&
|
||||
(((ctxt->validate) || (ctxt->loadsubset != 0)) &&
|
||||
(ctxt->wellFormed && ctxt->myDoc))) {
|
||||
@ -504,11 +491,6 @@ xmlSAX2ResolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId
|
||||
|
||||
URI = xmlBuildURI(systemId, (const xmlChar *) base);
|
||||
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2ResolveEntity(%s, %s)\n", publicId, systemId);
|
||||
#endif
|
||||
|
||||
ret = xmlLoadExternalEntity((const char *) URI,
|
||||
(const char *) publicId, ctxt);
|
||||
if (URI != NULL)
|
||||
@ -532,10 +514,6 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name)
|
||||
xmlEntityPtr ret = NULL;
|
||||
|
||||
if (ctx == NULL) return(NULL);
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2GetEntity(%s)\n", name);
|
||||
#endif
|
||||
|
||||
if (ctxt->inSubset == 0) {
|
||||
ret = xmlGetPredefinedEntity(name);
|
||||
@ -608,10 +586,6 @@ xmlSAX2GetParameterEntity(void *ctx, const xmlChar *name)
|
||||
xmlEntityPtr ret;
|
||||
|
||||
if (ctx == NULL) return(NULL);
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2GetParameterEntity(%s)\n", name);
|
||||
#endif
|
||||
|
||||
ret = xmlGetParameterEntity(ctxt->myDoc, name);
|
||||
return(ret);
|
||||
@ -637,11 +611,6 @@ xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type,
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
|
||||
if (ctx == NULL) return;
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2EntityDecl(%s, %d, %s, %s, %s)\n",
|
||||
name, type, publicId, systemId, content);
|
||||
#endif
|
||||
if (ctxt->inSubset == 1) {
|
||||
ent = xmlAddDocEntity(ctxt->myDoc, name, type, publicId,
|
||||
systemId, content);
|
||||
@ -711,11 +680,6 @@ xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
|
||||
if ((ctxt == NULL) || (ctxt->myDoc == NULL))
|
||||
return;
|
||||
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2AttributeDecl(%s, %s, %d, %d, %s, ...)\n",
|
||||
elem, fullname, type, def, defaultValue);
|
||||
#endif
|
||||
if ((xmlStrEqual(fullname, BAD_CAST "xml:id")) &&
|
||||
(type != XML_ATTRIBUTE_ID)) {
|
||||
/*
|
||||
@ -769,10 +733,6 @@ xmlSAX2ElementDecl(void *ctx, const xmlChar * name, int type,
|
||||
if ((ctxt == NULL) || (ctxt->myDoc == NULL))
|
||||
return;
|
||||
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2ElementDecl(%s, %d, ...)\n", name, type);
|
||||
#endif
|
||||
|
||||
if (ctxt->inSubset == 1)
|
||||
elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->intSubset,
|
||||
@ -807,10 +767,6 @@ xmlSAX2NotationDecl(void *ctx, const xmlChar *name,
|
||||
if ((ctxt == NULL) || (ctxt->myDoc == NULL))
|
||||
return;
|
||||
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2NotationDecl(%s, %s, %s)\n", name, publicId, systemId);
|
||||
#endif
|
||||
|
||||
if ((publicId == NULL) && (systemId == NULL)) {
|
||||
xmlFatalErrMsg(ctxt, XML_ERR_NOTATION_PROCESSING,
|
||||
@ -849,11 +805,6 @@ xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name,
|
||||
xmlEntityPtr ent;
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
if (ctx == NULL) return;
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2UnparsedEntityDecl(%s, %s, %s, %s)\n",
|
||||
name, publicId, systemId, notationName);
|
||||
#endif
|
||||
if (ctxt->inSubset == 1) {
|
||||
ent = xmlAddDocEntity(ctxt->myDoc, name,
|
||||
XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
|
||||
@ -913,10 +864,6 @@ void
|
||||
xmlSAX2SetDocumentLocator(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2SetDocumentLocator()\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -933,10 +880,6 @@ xmlSAX2StartDocument(void *ctx)
|
||||
|
||||
if (ctx == NULL) return;
|
||||
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2StartDocument()\n");
|
||||
#endif
|
||||
if (ctxt->html) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"libxml2 built without HTML support\n");
|
||||
@ -983,10 +926,6 @@ void
|
||||
xmlSAX2EndDocument(void *ctx)
|
||||
{
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2EndDocument()\n");
|
||||
#endif
|
||||
if (ctx == NULL) return;
|
||||
|
||||
/*
|
||||
@ -1518,18 +1457,10 @@ xmlSAX2Reference(void *ctx, const xmlChar *name)
|
||||
xmlNodePtr ret;
|
||||
|
||||
if (ctx == NULL) return;
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2Reference(%s)\n", name);
|
||||
#endif
|
||||
if (name[0] == '#')
|
||||
ret = xmlNewCharRef(ctxt->myDoc, name);
|
||||
else
|
||||
ret = xmlNewReference(ctxt->myDoc, name);
|
||||
#ifdef DEBUG_SAX_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"add xmlSAX2Reference %s to %s \n", name, ctxt->node->name);
|
||||
#endif
|
||||
if (xmlAddChild(ctxt->node, ret) == NULL) {
|
||||
xmlFreeNode(ret);
|
||||
}
|
||||
@ -1550,10 +1481,6 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len)
|
||||
xmlNodePtr lastChild;
|
||||
|
||||
if (ctx == NULL) return;
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2Characters(%.30s, %d)\n", ch, len);
|
||||
#endif
|
||||
/*
|
||||
* Handle the data if any. If there is no child
|
||||
* add it as content, otherwise if the last child is text,
|
||||
@ -1561,17 +1488,9 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len)
|
||||
*/
|
||||
|
||||
if (ctxt->node == NULL) {
|
||||
#ifdef DEBUG_SAX_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"add chars: ctxt->node == NULL !\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
lastChild = ctxt->node->last;
|
||||
#ifdef DEBUG_SAX_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"add chars to %s \n", ctxt->node->name);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Here we needed an accelerator mechanism in case of very large
|
||||
@ -1671,10 +1590,6 @@ void
|
||||
xmlSAX2IgnorableWhitespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2IgnorableWhitespace(%.30s, %d)\n", ch, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1695,10 +1610,6 @@ xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target,
|
||||
|
||||
if (ctx == NULL) return;
|
||||
parent = ctxt->node;
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.xmlSAX2ProcessingInstruction(%s, %s)\n", target, data);
|
||||
#endif
|
||||
|
||||
ret = xmlNewDocPI(ctxt->myDoc, target, data);
|
||||
if (ret == NULL) return;
|
||||
@ -1719,25 +1630,12 @@ xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target,
|
||||
return;
|
||||
}
|
||||
if ((ctxt->myDoc->children == NULL) || (parent == NULL)) {
|
||||
#ifdef DEBUG_SAX_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Setting PI %s as root\n", target);
|
||||
#endif
|
||||
xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
|
||||
return;
|
||||
}
|
||||
if (parent->type == XML_ELEMENT_NODE) {
|
||||
#ifdef DEBUG_SAX_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"adding PI %s child to %s\n", target, parent->name);
|
||||
#endif
|
||||
xmlAddChild(parent, ret);
|
||||
} else {
|
||||
#ifdef DEBUG_SAX_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"adding PI %s sibling to ", target);
|
||||
xmlDebugDumpOneNode(stderr, parent, 0);
|
||||
#endif
|
||||
xmlAddSibling(parent, ret);
|
||||
}
|
||||
}
|
||||
@ -1758,9 +1656,6 @@ xmlSAX2Comment(void *ctx, const xmlChar *value)
|
||||
|
||||
if (ctx == NULL) return;
|
||||
parent = ctxt->node;
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2Comment(%s)\n", value);
|
||||
#endif
|
||||
ret = xmlNewDocComment(ctxt->myDoc, value);
|
||||
if (ret == NULL) return;
|
||||
if (ctxt->linenumbers) {
|
||||
@ -1780,25 +1675,12 @@ xmlSAX2Comment(void *ctx, const xmlChar *value)
|
||||
return;
|
||||
}
|
||||
if ((ctxt->myDoc->children == NULL) || (parent == NULL)) {
|
||||
#ifdef DEBUG_SAX_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Setting xmlSAX2Comment as root\n");
|
||||
#endif
|
||||
xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
|
||||
return;
|
||||
}
|
||||
if (parent->type == XML_ELEMENT_NODE) {
|
||||
#ifdef DEBUG_SAX_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"adding xmlSAX2Comment child to %s\n", parent->name);
|
||||
#endif
|
||||
xmlAddChild(parent, ret);
|
||||
} else {
|
||||
#ifdef DEBUG_SAX_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"adding xmlSAX2Comment sibling to ");
|
||||
xmlDebugDumpOneNode(stderr, parent, 0);
|
||||
#endif
|
||||
xmlAddSibling(parent, ret);
|
||||
}
|
||||
}
|
||||
@ -1818,15 +1700,7 @@ xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len)
|
||||
xmlNodePtr ret, lastChild;
|
||||
|
||||
if (ctx == NULL) return;
|
||||
#ifdef DEBUG_SAX
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"SAX.pcdata(%.10s, %d)\n", value, len);
|
||||
#endif
|
||||
lastChild = xmlGetLastChild(ctxt->node);
|
||||
#ifdef DEBUG_SAX_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"add chars to %s \n", ctxt->node->name);
|
||||
#endif
|
||||
if ((lastChild != NULL) &&
|
||||
(lastChild->type == XML_CDATA_SECTION_NODE)) {
|
||||
xmlTextConcat(lastChild, value, len);
|
||||
|
@ -57,9 +57,6 @@ typedef unsigned __int32 uint32_t;
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/globals.h>
|
||||
|
||||
/* #define DEBUG_GROW */
|
||||
/* #define DICT_DEBUG_PATTERNS */
|
||||
|
||||
#define MAX_HASH_LEN 3
|
||||
#define MIN_DICT_SIZE 128
|
||||
#define MAX_DICT_HASH 8 * 2048
|
||||
@ -187,9 +184,6 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, int namelen) {
|
||||
const xmlChar *ret;
|
||||
int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */
|
||||
|
||||
#ifdef DICT_DEBUG_PATTERNS
|
||||
fprintf(stderr, "-");
|
||||
#endif
|
||||
pool = dict->strings;
|
||||
while (pool != NULL) {
|
||||
if (pool->end - pool->free > namelen)
|
||||
@ -214,9 +208,6 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, int namelen) {
|
||||
pool->end = &pool->array[size];
|
||||
pool->next = dict->strings;
|
||||
dict->strings = pool;
|
||||
#ifdef DICT_DEBUG_PATTERNS
|
||||
fprintf(stderr, "+");
|
||||
#endif
|
||||
}
|
||||
found_pool:
|
||||
ret = pool->free;
|
||||
@ -249,9 +240,6 @@ xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, int plen,
|
||||
|
||||
if (prefix == NULL) return(xmlDictAddString(dict, name, namelen));
|
||||
|
||||
#ifdef DICT_DEBUG_PATTERNS
|
||||
fprintf(stderr, "=");
|
||||
#endif
|
||||
pool = dict->strings;
|
||||
while (pool != NULL) {
|
||||
if (pool->end - pool->free > namelen + plen + 1)
|
||||
@ -276,9 +264,6 @@ xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, int plen,
|
||||
pool->end = &pool->array[size];
|
||||
pool->next = dict->strings;
|
||||
dict->strings = pool;
|
||||
#ifdef DICT_DEBUG_PATTERNS
|
||||
fprintf(stderr, "+");
|
||||
#endif
|
||||
}
|
||||
found_pool:
|
||||
ret = pool->free;
|
||||
@ -472,9 +457,6 @@ xmlDictCreate(void) {
|
||||
if (!xmlInitializeDict())
|
||||
return(NULL);
|
||||
|
||||
#ifdef DICT_DEBUG_PATTERNS
|
||||
fprintf(stderr, "C");
|
||||
#endif
|
||||
|
||||
dict = xmlMalloc(sizeof(xmlDict));
|
||||
if (dict) {
|
||||
@ -515,9 +497,6 @@ xmlDictCreateSub(xmlDictPtr sub) {
|
||||
xmlDictPtr dict = xmlDictCreate();
|
||||
|
||||
if ((dict != NULL) && (sub != NULL)) {
|
||||
#ifdef DICT_DEBUG_PATTERNS
|
||||
fprintf(stderr, "R");
|
||||
#endif
|
||||
dict->seed = sub->seed;
|
||||
dict->subdict = sub;
|
||||
xmlDictReference(dict->subdict);
|
||||
@ -561,9 +540,6 @@ xmlDictGrow(xmlDictPtr dict, int size) {
|
||||
int oldsize, i;
|
||||
xmlDictEntryPtr iter, next;
|
||||
struct _xmlDictEntry *olddict;
|
||||
#ifdef DEBUG_GROW
|
||||
unsigned long nbElem = 0;
|
||||
#endif
|
||||
int ret = 0;
|
||||
int keep_keys = 1;
|
||||
|
||||
@ -574,9 +550,6 @@ xmlDictGrow(xmlDictPtr dict, int size) {
|
||||
if (size > 8 * 2048)
|
||||
return(-1);
|
||||
|
||||
#ifdef DICT_DEBUG_PATTERNS
|
||||
fprintf(stderr, "*");
|
||||
#endif
|
||||
|
||||
oldsize = dict->size;
|
||||
olddict = dict->dict;
|
||||
@ -632,9 +605,6 @@ xmlDictGrow(xmlDictPtr dict, int size) {
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_GROW
|
||||
nbElem++;
|
||||
#endif
|
||||
}
|
||||
|
||||
for (i = 0; i < oldsize; i++) {
|
||||
@ -663,9 +633,6 @@ xmlDictGrow(xmlDictPtr dict, int size) {
|
||||
dict->dict[key].next = iter;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_GROW
|
||||
nbElem++;
|
||||
#endif
|
||||
|
||||
iter = next;
|
||||
}
|
||||
@ -673,10 +640,6 @@ xmlDictGrow(xmlDictPtr dict, int size) {
|
||||
|
||||
xmlFree(olddict);
|
||||
|
||||
#ifdef DEBUG_GROW
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlDictGrow : from %d to %d, %d elems\n", oldsize, size, nbElem);
|
||||
#endif
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
@ -55,15 +55,9 @@ static xmlCharEncodingAliasPtr xmlCharEncodingAliases = NULL;
|
||||
static int xmlCharEncodingAliasesNb = 0;
|
||||
static int xmlCharEncodingAliasesMax = 0;
|
||||
|
||||
#if defined(LIBXML_ICONV_ENABLED)
|
||||
#if 0
|
||||
#define DEBUG_ENCODING /* Define this to get encoding traces */
|
||||
#endif
|
||||
#else
|
||||
#ifdef LIBXML_ISO8859X_ENABLED
|
||||
static void xmlRegisterCharEncodingHandlersISO8859x (void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static int xmlLittleEndian = 1;
|
||||
|
||||
@ -712,9 +706,6 @@ xmlParseCharEncoding(const char* name)
|
||||
if (!strcmp(upper, "SHIFT_JIS")) return(XML_CHAR_ENCODING_SHIFT_JIS);
|
||||
if (!strcmp(upper, "EUC-JP")) return(XML_CHAR_ENCODING_EUC_JP);
|
||||
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext, "Unknown encoding %s\n", name);
|
||||
#endif
|
||||
return(XML_CHAR_ENCODING_ERROR);
|
||||
}
|
||||
|
||||
@ -873,10 +864,6 @@ xmlNewCharEncodingHandler(const char *name,
|
||||
* registers and returns the handler.
|
||||
*/
|
||||
xmlRegisterCharEncodingHandler(handler);
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Registered encoding handler for %s\n", name);
|
||||
#endif
|
||||
return(handler);
|
||||
}
|
||||
|
||||
@ -1101,10 +1088,6 @@ xmlGetCharEncodingHandler(xmlCharEncoding enc) {
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"No handler found for encoding %d\n", enc);
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -1152,10 +1135,6 @@ xmlFindCharEncodingHandler(const char *name) {
|
||||
if (handlers != NULL) {
|
||||
for (i = 0;i < nbCharEncodingHandler; i++) {
|
||||
if (!strcmp(upper, handlers[i]->name)) {
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Found registered handler for encoding %s\n", name);
|
||||
#endif
|
||||
return(handlers[i]);
|
||||
}
|
||||
}
|
||||
@ -1185,10 +1164,6 @@ xmlFindCharEncodingHandler(const char *name) {
|
||||
enc->output = NULL;
|
||||
enc->iconv_in = icv_in;
|
||||
enc->iconv_out = icv_out;
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Found iconv handler for encoding %s\n", name);
|
||||
#endif
|
||||
return enc;
|
||||
} else if ((icv_in != (iconv_t) -1) || icv_out != (iconv_t) -1) {
|
||||
xmlEncodingErr(XML_ERR_INTERNAL_ERROR,
|
||||
@ -1196,11 +1171,6 @@ xmlFindCharEncodingHandler(const char *name) {
|
||||
}
|
||||
#endif /* LIBXML_ICONV_ENABLED */
|
||||
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"No handler found for encoding %s\n", name);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Fallback using the canonical names
|
||||
*/
|
||||
@ -1358,29 +1328,6 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
|
||||
if (ret == -1) ret = -3;
|
||||
}
|
||||
#endif /* LIBXML_ICONV_ENABLED */
|
||||
#ifdef DEBUG_ENCODING
|
||||
switch (ret) {
|
||||
case 0:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"converted %d bytes to %d bytes of input\n",
|
||||
toconv, written);
|
||||
break;
|
||||
case -1:
|
||||
xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of input, %d left\n",
|
||||
toconv, written, in->use);
|
||||
break;
|
||||
case -2:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"input conversion failed due to input error\n");
|
||||
break;
|
||||
case -3:
|
||||
xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of input, %d left\n",
|
||||
toconv, written, in->use);
|
||||
break;
|
||||
default:
|
||||
xmlGenericError(xmlGenericErrorContext,"Unknown input conversion failed %d\n", ret);
|
||||
}
|
||||
#endif /* DEBUG_ENCODING */
|
||||
/*
|
||||
* Ignore when input buffer is not on a boundary
|
||||
*/
|
||||
@ -1465,25 +1412,10 @@ xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out,
|
||||
#endif /* LIBXML_ICONV_ENABLED */
|
||||
switch (ret) {
|
||||
case 0:
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"converted %d bytes to %d bytes of input\n",
|
||||
toconv, written);
|
||||
#endif
|
||||
break;
|
||||
case -1:
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"converted %d bytes to %d bytes of input, %d left\n",
|
||||
toconv, written, in->use);
|
||||
#endif
|
||||
break;
|
||||
case -3:
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"converted %d bytes to %d bytes of input, %d left\n",
|
||||
toconv, written, in->use);
|
||||
#endif
|
||||
break;
|
||||
case -2: {
|
||||
char buf[50];
|
||||
@ -1563,10 +1495,6 @@ retry:
|
||||
out->content[out->use] = 0;
|
||||
}
|
||||
#endif /* LIBXML_ICONV_ENABLED */
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"initialized encoder\n");
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -1622,23 +1550,10 @@ retry:
|
||||
*/
|
||||
switch (ret) {
|
||||
case 0:
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"converted %d bytes to %d bytes of output\n",
|
||||
toconv, written);
|
||||
#endif
|
||||
break;
|
||||
case -1:
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"output conversion failed by lack of space\n");
|
||||
#endif
|
||||
break;
|
||||
case -3:
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of output %d left\n",
|
||||
toconv, written, in->use);
|
||||
#endif
|
||||
break;
|
||||
case -2: {
|
||||
int len = in->use;
|
||||
@ -1649,14 +1564,6 @@ retry:
|
||||
if (cur > 0) {
|
||||
xmlChar charref[20];
|
||||
|
||||
#ifdef DEBUG_ENCODING
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"handling output conversion error\n");
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
|
||||
in->content[0], in->content[1],
|
||||
in->content[2], in->content[3]);
|
||||
#endif
|
||||
/*
|
||||
* Removes the UTF8 sequence, and replace it by a charref
|
||||
* and continue the transcoding phase, hoping the error
|
||||
@ -1726,14 +1633,6 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
|
||||
handler->name = NULL;
|
||||
xmlFree(handler);
|
||||
}
|
||||
#ifdef DEBUG_ENCODING
|
||||
if (ret)
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"failed to close the encoding handler\n");
|
||||
else
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"closed the encoding handler\n");
|
||||
#endif
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
@ -23,8 +23,6 @@
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/threads.h>
|
||||
|
||||
/* #define DEBUG_GLOBALS */
|
||||
|
||||
/*
|
||||
* Helpful Macro
|
||||
*/
|
||||
@ -75,13 +73,6 @@ void xmlCleanupGlobals(void)
|
||||
#undef xmlMemStrdup
|
||||
#undef xmlRealloc
|
||||
|
||||
#if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
|
||||
xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
|
||||
xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
|
||||
xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
|
||||
xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
|
||||
xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
|
||||
#else
|
||||
/**
|
||||
* xmlFree:
|
||||
* @mem: an already allocated block of memory
|
||||
@ -128,7 +119,6 @@ xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
|
||||
* Returns the copy of the string or NULL in case of error
|
||||
*/
|
||||
xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
|
||||
#endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
|
||||
|
||||
#include <libxml/threads.h>
|
||||
#include <libxml/globals.h>
|
||||
@ -375,11 +365,6 @@ xmlSAXLocator xmlDefaultSAXLocator = {
|
||||
void
|
||||
xmlInitializeGlobalState(xmlGlobalStatePtr gs)
|
||||
{
|
||||
#ifdef DEBUG_GLOBALS
|
||||
fprintf(stderr, "Initializing globals at %lu for thread %d\n",
|
||||
(unsigned long) gs, xmlGetThreadId());
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Perform initialization as required by libxml
|
||||
*/
|
||||
@ -397,19 +382,11 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
|
||||
gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
|
||||
gs->xmlDoValidityCheckingDefaultValue =
|
||||
xmlDoValidityCheckingDefaultValueThrDef;
|
||||
#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
|
||||
gs->xmlFree = (xmlFreeFunc) xmlMemFree;
|
||||
gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
|
||||
gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
|
||||
gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
|
||||
gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
|
||||
#else
|
||||
gs->xmlFree = (xmlFreeFunc) free;
|
||||
gs->xmlMalloc = (xmlMallocFunc) malloc;
|
||||
gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
|
||||
gs->xmlRealloc = (xmlReallocFunc) realloc;
|
||||
gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
|
||||
#endif
|
||||
gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
|
||||
gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
|
||||
gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
|
||||
|
@ -45,8 +45,6 @@
|
||||
|
||||
#define MAX_HASH_LEN 8
|
||||
|
||||
/* #define DEBUG_GROW */
|
||||
|
||||
#ifdef HASH_RANDOMIZATION
|
||||
static int hash_initialized = 0;
|
||||
#endif
|
||||
@ -235,9 +233,6 @@ xmlHashGrow(xmlHashTablePtr table, int size) {
|
||||
int oldsize, i;
|
||||
xmlHashEntryPtr iter, next;
|
||||
struct _xmlHashEntry *oldtable;
|
||||
#ifdef DEBUG_GROW
|
||||
unsigned long nbElem = 0;
|
||||
#endif
|
||||
|
||||
if (table == NULL)
|
||||
return(-1);
|
||||
@ -294,9 +289,6 @@ xmlHashGrow(xmlHashTablePtr table, int size) {
|
||||
table->table[key].next = iter;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_GROW
|
||||
nbElem++;
|
||||
#endif
|
||||
|
||||
iter = next;
|
||||
}
|
||||
@ -304,10 +296,6 @@ xmlHashGrow(xmlHashTablePtr table, int size) {
|
||||
|
||||
xmlFree(oldtable);
|
||||
|
||||
#ifdef DEBUG_GROW
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlHashGrow : from %d to %d, %d elems\n", oldsize, size, nbElem);
|
||||
#endif
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
@ -837,11 +837,7 @@ xmlHasFeature(xmlFeature feature)
|
||||
case XML_WITH_DEBUG:
|
||||
return(0);
|
||||
case XML_WITH_DEBUG_MEM:
|
||||
#ifdef DEBUG_MEMORY_LOCATION
|
||||
return(1);
|
||||
#else
|
||||
return(0);
|
||||
#endif
|
||||
case XML_WITH_DEBUG_RUN:
|
||||
return(0);
|
||||
case XML_WITH_ZLIB:
|
||||
@ -2949,14 +2945,6 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
|
||||
* Routines to parse Name, NCName and NmToken *
|
||||
* *
|
||||
************************************************************************/
|
||||
#ifdef DEBUG
|
||||
static unsigned long nbParseName = 0;
|
||||
static unsigned long nbParseNmToken = 0;
|
||||
static unsigned long nbParseNCName = 0;
|
||||
static unsigned long nbParseNCNameComplex = 0;
|
||||
static unsigned long nbParseNameComplex = 0;
|
||||
static unsigned long nbParseStringName = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The two following functions are related to the change of accepted
|
||||
@ -3047,10 +3035,6 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
|
||||
int c;
|
||||
int count = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
nbParseNameComplex++;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Handler for more complex cases
|
||||
*/
|
||||
@ -3165,10 +3149,6 @@ xmlParseName(xmlParserCtxtPtr ctxt) {
|
||||
|
||||
GROW;
|
||||
|
||||
#ifdef DEBUG
|
||||
nbParseName++;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Accelerator for simple ASCII names
|
||||
*/
|
||||
@ -3204,10 +3184,6 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
|
||||
int c;
|
||||
int count = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
nbParseNCNameComplex++;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Handler for more complex cases
|
||||
*/
|
||||
@ -3252,10 +3228,6 @@ xmlParseNCName(xmlParserCtxtPtr ctxt) {
|
||||
const xmlChar *ret;
|
||||
int count = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
nbParseNCName++;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Accelerator for simple ASCII names
|
||||
*/
|
||||
@ -3349,10 +3321,6 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
|
||||
int len = 0, l;
|
||||
int c;
|
||||
|
||||
#ifdef DEBUG
|
||||
nbParseStringName++;
|
||||
#endif
|
||||
|
||||
c = CUR_SCHAR(cur, l);
|
||||
if (!xmlIsNameStartChar(ctxt, c)) {
|
||||
return(NULL);
|
||||
@ -3425,10 +3393,6 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
|
||||
int c;
|
||||
int count = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
nbParseNmToken++;
|
||||
#endif
|
||||
|
||||
GROW;
|
||||
c = CUR_CHAR(l);
|
||||
|
||||
@ -9986,35 +9950,10 @@ xmlParseLookupSequence(xmlParserCtxtPtr ctxt, xmlChar first,
|
||||
if (buf[base + 1] != next) continue;
|
||||
}
|
||||
ctxt->checkIndex = 0;
|
||||
#ifdef DEBUG_PUSH
|
||||
if (next == 0)
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: lookup '%c' found at %d\n",
|
||||
first, base);
|
||||
else if (third == 0)
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: lookup '%c%c' found at %d\n",
|
||||
first, next, base);
|
||||
else
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: lookup '%c%c%c' found at %d\n",
|
||||
first, next, third, base);
|
||||
#endif
|
||||
return(base - (in->cur - in->base));
|
||||
}
|
||||
}
|
||||
ctxt->checkIndex = base;
|
||||
#ifdef DEBUG_PUSH
|
||||
if (next == 0)
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: lookup '%c' failed\n", first);
|
||||
else if (third == 0)
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: lookup '%c%c' failed\n", first, next);
|
||||
else
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: lookup '%c%c%c' failed\n", first, next, third);
|
||||
#endif
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@ -10161,59 +10100,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
if (ctxt->input == NULL)
|
||||
return(0);
|
||||
|
||||
#ifdef DEBUG_PUSH
|
||||
switch (ctxt->instate) {
|
||||
case XML_PARSER_EOF:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try EOF\n"); break;
|
||||
case XML_PARSER_START:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try START\n"); break;
|
||||
case XML_PARSER_MISC:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try MISC\n");break;
|
||||
case XML_PARSER_COMMENT:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try COMMENT\n");break;
|
||||
case XML_PARSER_PROLOG:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try PROLOG\n");break;
|
||||
case XML_PARSER_START_TAG:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try START_TAG\n");break;
|
||||
case XML_PARSER_CONTENT:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try CONTENT\n");break;
|
||||
case XML_PARSER_CDATA_SECTION:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try CDATA_SECTION\n");break;
|
||||
case XML_PARSER_END_TAG:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try END_TAG\n");break;
|
||||
case XML_PARSER_ENTITY_DECL:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try ENTITY_DECL\n");break;
|
||||
case XML_PARSER_ENTITY_VALUE:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try ENTITY_VALUE\n");break;
|
||||
case XML_PARSER_ATTRIBUTE_VALUE:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try ATTRIBUTE_VALUE\n");break;
|
||||
case XML_PARSER_DTD:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try DTD\n");break;
|
||||
case XML_PARSER_EPILOG:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try EPILOG\n");break;
|
||||
case XML_PARSER_PI:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try PI\n");break;
|
||||
case XML_PARSER_IGNORE:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: try IGNORE\n");break;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((ctxt->input != NULL) &&
|
||||
(ctxt->input->cur - ctxt->input->base > 4096)) {
|
||||
xmlSHRINK(ctxt);
|
||||
@ -10303,10 +10189,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
&xmlDefaultSAXLocator);
|
||||
xmlFatalErr(ctxt, XML_ERR_DOCUMENT_EMPTY, NULL);
|
||||
ctxt->instate = XML_PARSER_EOF;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering EOF\n");
|
||||
#endif
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
||||
ctxt->sax->endDocument(ctxt->userData);
|
||||
goto done;
|
||||
@ -10325,10 +10207,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
(ctxt->input->cur[4] == 'l') &&
|
||||
(IS_BLANK_CH(ctxt->input->cur[5]))) {
|
||||
ret += 5;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: Parsing XML Decl\n");
|
||||
#endif
|
||||
xmlParseXMLDecl(ctxt);
|
||||
if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
|
||||
/*
|
||||
@ -10346,20 +10224,12 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
(!ctxt->disableSAX))
|
||||
ctxt->sax->startDocument(ctxt->userData);
|
||||
ctxt->instate = XML_PARSER_MISC;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering MISC\n");
|
||||
#endif
|
||||
} else {
|
||||
ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION);
|
||||
if ((ctxt->sax) && (ctxt->sax->startDocument) &&
|
||||
(!ctxt->disableSAX))
|
||||
ctxt->sax->startDocument(ctxt->userData);
|
||||
ctxt->instate = XML_PARSER_MISC;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering MISC\n");
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
|
||||
@ -10374,10 +10244,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
(!ctxt->disableSAX))
|
||||
ctxt->sax->startDocument(ctxt->userData);
|
||||
ctxt->instate = XML_PARSER_MISC;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering MISC\n");
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case XML_PARSER_START_TAG: {
|
||||
@ -10648,10 +10514,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
SKIPL(base + 3);
|
||||
ctxt->checkIndex = 0;
|
||||
ctxt->instate = XML_PARSER_CONTENT;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering CONTENT\n");
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -10671,10 +10533,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
if ((!terminate) &&
|
||||
(xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
|
||||
goto done;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: Parsing PI\n");
|
||||
#endif
|
||||
xmlParsePI(ctxt);
|
||||
ctxt->checkIndex = 0;
|
||||
} else if ((cur == '<') && (next == '!') &&
|
||||
@ -10683,10 +10541,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
if ((!terminate) &&
|
||||
(xmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
|
||||
goto done;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: Parsing Comment\n");
|
||||
#endif
|
||||
xmlParseComment(ctxt);
|
||||
ctxt->instate = XML_PARSER_MISC;
|
||||
ctxt->checkIndex = 0;
|
||||
@ -10701,18 +10555,10 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
if ((!terminate) &&
|
||||
(xmlParseLookupSequence(ctxt, '>', 0, 0) < 0))
|
||||
goto done;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: Parsing internal subset\n");
|
||||
#endif
|
||||
ctxt->inSubset = 1;
|
||||
xmlParseDocTypeDecl(ctxt);
|
||||
if (RAW == '[') {
|
||||
ctxt->instate = XML_PARSER_DTD;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering DTD\n");
|
||||
#endif
|
||||
} else {
|
||||
/*
|
||||
* Create and update the external subset.
|
||||
@ -10726,10 +10572,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
ctxt->inSubset = 0;
|
||||
xmlCleanSpecialAttr(ctxt);
|
||||
ctxt->instate = XML_PARSER_PROLOG;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering PROLOG\n");
|
||||
#endif
|
||||
}
|
||||
} else if ((cur == '<') && (next == '!') &&
|
||||
(avail < 9)) {
|
||||
@ -10738,10 +10580,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
ctxt->instate = XML_PARSER_START_TAG;
|
||||
ctxt->progressive = 1;
|
||||
xmlParseGetLasts(ctxt, &lastlt, &lastgt);
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering START_TAG\n");
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case XML_PARSER_PROLOG:
|
||||
@ -10758,20 +10596,12 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
if ((!terminate) &&
|
||||
(xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
|
||||
goto done;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: Parsing PI\n");
|
||||
#endif
|
||||
xmlParsePI(ctxt);
|
||||
} else if ((cur == '<') && (next == '!') &&
|
||||
(ctxt->input->cur[2] == '-') && (ctxt->input->cur[3] == '-')) {
|
||||
if ((!terminate) &&
|
||||
(xmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
|
||||
goto done;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: Parsing Comment\n");
|
||||
#endif
|
||||
xmlParseComment(ctxt);
|
||||
ctxt->instate = XML_PARSER_PROLOG;
|
||||
} else if ((cur == '<') && (next == '!') &&
|
||||
@ -10782,10 +10612,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
if (ctxt->progressive == 0)
|
||||
ctxt->progressive = 1;
|
||||
xmlParseGetLasts(ctxt, &lastlt, &lastgt);
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering START_TAG\n");
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case XML_PARSER_EPILOG:
|
||||
@ -10802,10 +10628,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
if ((!terminate) &&
|
||||
(xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
|
||||
goto done;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: Parsing PI\n");
|
||||
#endif
|
||||
xmlParsePI(ctxt);
|
||||
ctxt->instate = XML_PARSER_EPILOG;
|
||||
} else if ((cur == '<') && (next == '!') &&
|
||||
@ -10813,10 +10635,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
if ((!terminate) &&
|
||||
(xmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
|
||||
goto done;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: Parsing Comment\n");
|
||||
#endif
|
||||
xmlParseComment(ctxt);
|
||||
ctxt->instate = XML_PARSER_EPILOG;
|
||||
} else if ((cur == '<') && (next == '!') &&
|
||||
@ -10825,10 +10643,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
} else {
|
||||
xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL);
|
||||
ctxt->instate = XML_PARSER_EOF;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering EOF\n");
|
||||
#endif
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
||||
ctxt->sax->endDocument(ctxt->userData);
|
||||
goto done;
|
||||
@ -10937,11 +10751,6 @@ not_end_of_int_subset:
|
||||
/*
|
||||
* We didn't found the end of the Internal subset
|
||||
*/
|
||||
#ifdef DEBUG_PUSH
|
||||
if (next == 0)
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: lookup of int subset end filed\n");
|
||||
#endif
|
||||
goto done;
|
||||
|
||||
found_end_int_subset:
|
||||
@ -10955,90 +10764,51 @@ found_end_int_subset:
|
||||
xmlCleanSpecialAttr(ctxt);
|
||||
ctxt->instate = XML_PARSER_PROLOG;
|
||||
ctxt->checkIndex = 0;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering PROLOG\n");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case XML_PARSER_COMMENT:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: internal error, state == COMMENT\n");
|
||||
ctxt->instate = XML_PARSER_CONTENT;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering CONTENT\n");
|
||||
#endif
|
||||
break;
|
||||
case XML_PARSER_IGNORE:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: internal error, state == IGNORE");
|
||||
ctxt->instate = XML_PARSER_DTD;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering DTD\n");
|
||||
#endif
|
||||
break;
|
||||
case XML_PARSER_PI:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: internal error, state == PI\n");
|
||||
ctxt->instate = XML_PARSER_CONTENT;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering CONTENT\n");
|
||||
#endif
|
||||
break;
|
||||
case XML_PARSER_ENTITY_DECL:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: internal error, state == ENTITY_DECL\n");
|
||||
ctxt->instate = XML_PARSER_DTD;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering DTD\n");
|
||||
#endif
|
||||
break;
|
||||
case XML_PARSER_ENTITY_VALUE:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: internal error, state == ENTITY_VALUE\n");
|
||||
ctxt->instate = XML_PARSER_CONTENT;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering DTD\n");
|
||||
#endif
|
||||
break;
|
||||
case XML_PARSER_ATTRIBUTE_VALUE:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: internal error, state == ATTRIBUTE_VALUE\n");
|
||||
ctxt->instate = XML_PARSER_START_TAG;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering START_TAG\n");
|
||||
#endif
|
||||
break;
|
||||
case XML_PARSER_SYSTEM_LITERAL:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: internal error, state == SYSTEM_LITERAL\n");
|
||||
ctxt->instate = XML_PARSER_START_TAG;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering START_TAG\n");
|
||||
#endif
|
||||
break;
|
||||
case XML_PARSER_PUBLIC_LITERAL:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: internal error, state == PUBLIC_LITERAL\n");
|
||||
ctxt->instate = XML_PARSER_START_TAG;
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering START_TAG\n");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
done:
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext, "PP: done %d\n", ret);
|
||||
#endif
|
||||
return(ret);
|
||||
encoding_error:
|
||||
{
|
||||
@ -11136,9 +10906,6 @@ xmldecl_done:
|
||||
ctxt->input->cur = ctxt->input->base + cur;
|
||||
ctxt->input->end =
|
||||
&ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->use];
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext, "PP: pushed %d\n", size);
|
||||
#endif
|
||||
|
||||
} else if (ctxt->instate != XML_PARSER_EOF) {
|
||||
if ((ctxt->input != NULL) && ctxt->input->buf != NULL) {
|
||||
@ -11327,9 +11094,6 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
|
||||
ctxt->input->cur = ctxt->input->base + cur;
|
||||
ctxt->input->end =
|
||||
&ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->use];
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext, "PP: pushed %d\n", size);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (enc != XML_CHAR_ENCODING_NONE) {
|
||||
@ -12709,9 +12473,6 @@ xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk,
|
||||
ctxt->input->end =
|
||||
&ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->
|
||||
use];
|
||||
#ifdef DEBUG_PUSH
|
||||
xmlGenericError(xmlGenericErrorContext, "PP: pushed %d\n", size);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (encoding != NULL) {
|
||||
|
@ -226,39 +226,10 @@ xmlIsLetter(int c) {
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
/* #define DEBUG_INPUT */
|
||||
/* #define DEBUG_STACK */
|
||||
/* #define DEBUG_PUSH */
|
||||
|
||||
|
||||
/* we need to keep enough input to show errors in context */
|
||||
#define LINE_LEN 80
|
||||
|
||||
#ifdef DEBUG_INPUT
|
||||
#define CHECK_BUFFER(in) check_buffer(in)
|
||||
|
||||
static
|
||||
void check_buffer(xmlParserInputPtr in) {
|
||||
if (in->base != in->buf->buffer->content) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlParserInput: base mismatch problem\n");
|
||||
}
|
||||
if (in->cur < in->base) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlParserInput: cur < base problem\n");
|
||||
}
|
||||
if (in->cur > in->base + in->buf->buffer->use) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlParserInput: cur > base + use problem\n");
|
||||
}
|
||||
xmlGenericError(xmlGenericErrorContext,"buffer %x : content %x, cur %d, use %d, size %d\n",
|
||||
(int) in, (int) in->buf->buffer->content, in->cur - in->base,
|
||||
in->buf->buffer->use, in->buf->buffer->size);
|
||||
}
|
||||
|
||||
#else
|
||||
#define CHECK_BUFFER(in)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
@ -279,9 +250,6 @@ xmlParserInputRead(xmlParserInputPtr in, int len) {
|
||||
int indx;
|
||||
|
||||
if (in == NULL) return(-1);
|
||||
#ifdef DEBUG_INPUT
|
||||
xmlGenericError(xmlGenericErrorContext, "Read\n");
|
||||
#endif
|
||||
if (in->buf == NULL) return(-1);
|
||||
if (in->base == NULL) return(-1);
|
||||
if (in->cur == NULL) return(-1);
|
||||
@ -329,9 +297,6 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) {
|
||||
int indx;
|
||||
|
||||
if (in == NULL) return(-1);
|
||||
#ifdef DEBUG_INPUT
|
||||
xmlGenericError(xmlGenericErrorContext, "Grow\n");
|
||||
#endif
|
||||
if (in->buf == NULL) return(-1);
|
||||
if (in->base == NULL) return(-1);
|
||||
if (in->cur == NULL) return(-1);
|
||||
@ -384,9 +349,6 @@ xmlParserInputShrink(xmlParserInputPtr in) {
|
||||
int ret;
|
||||
int indx;
|
||||
|
||||
#ifdef DEBUG_INPUT
|
||||
xmlGenericError(xmlGenericErrorContext, "Shrink\n");
|
||||
#endif
|
||||
if (in == NULL) return;
|
||||
if (in->buf == NULL) return;
|
||||
if (in->base == NULL) return;
|
||||
|
@ -128,9 +128,6 @@ static int xmlCheckDTD = 1;
|
||||
#define IS_STR_XML(str) ((str != NULL) && (str[0] == 'x') && \
|
||||
(str[1] == 'm') && (str[2] == 'l') && (str[3] == 0))
|
||||
|
||||
/* #define DEBUG_BUFFER */
|
||||
/* #define DEBUG_TREE */
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Functions to move to entities.c once the *
|
||||
@ -784,10 +781,6 @@ xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix) {
|
||||
void
|
||||
xmlSetNs(xmlNodePtr node, xmlNsPtr ns) {
|
||||
if (node == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlSetNs: node == NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
node->ns = ns;
|
||||
@ -802,10 +795,6 @@ xmlSetNs(xmlNodePtr node, xmlNsPtr ns) {
|
||||
void
|
||||
xmlFreeNs(xmlNsPtr cur) {
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlFreeNs : ns == NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (cur->href != NULL) xmlFree((char *) cur->href);
|
||||
@ -823,10 +812,6 @@ void
|
||||
xmlFreeNsList(xmlNsPtr cur) {
|
||||
xmlNsPtr next;
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlFreeNsList : ns == NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
while (cur != NULL) {
|
||||
@ -854,12 +839,6 @@ xmlNewDtd(xmlDocPtr doc, const xmlChar *name,
|
||||
xmlDtdPtr cur;
|
||||
|
||||
if ((doc != NULL) && (doc->extSubset != NULL)) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewDtd(%s): document %s already have a DTD %s\n",
|
||||
/* !!! */ (char *) name, doc->name,
|
||||
/* !!! */ (char *)doc->extSubset->name);
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -928,12 +907,6 @@ xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name,
|
||||
xmlDtdPtr cur;
|
||||
|
||||
if ((doc != NULL) && (xmlGetIntSubset(doc) != NULL)) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
|
||||
"xmlCreateIntSubset(): document %s already have an internal subset\n",
|
||||
doc->name);
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -1187,10 +1160,6 @@ xmlFreeDoc(xmlDocPtr cur) {
|
||||
xmlDictPtr dict = NULL;
|
||||
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlFreeDoc : document == NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1882,10 +1851,6 @@ xmlAttrPtr
|
||||
xmlNewProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) {
|
||||
|
||||
if (name == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewProp : name == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -1908,10 +1873,6 @@ xmlNewNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name,
|
||||
const xmlChar *value) {
|
||||
|
||||
if (name == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewNsProp : name == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -1933,10 +1894,6 @@ xmlNewNsPropEatName(xmlNodePtr node, xmlNsPtr ns, xmlChar *name,
|
||||
const xmlChar *value) {
|
||||
|
||||
if (name == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewNsPropEatName : name == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -1957,10 +1914,6 @@ xmlNewDocProp(xmlDocPtr doc, const xmlChar *name, const xmlChar *value) {
|
||||
xmlAttrPtr cur;
|
||||
|
||||
if (name == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewDocProp : name == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -2055,17 +2008,9 @@ int
|
||||
xmlRemoveProp(xmlAttrPtr cur) {
|
||||
xmlAttrPtr tmp;
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlRemoveProp : cur == NULL\n");
|
||||
#endif
|
||||
return(-1);
|
||||
}
|
||||
if (cur->parent == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlRemoveProp : cur->parent == NULL\n");
|
||||
#endif
|
||||
return(-1);
|
||||
}
|
||||
tmp = cur->parent->properties;
|
||||
@ -2086,10 +2031,6 @@ xmlRemoveProp(xmlAttrPtr cur) {
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlRemoveProp : attribute not owned by its node\n");
|
||||
#endif
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@ -2107,10 +2048,6 @@ xmlNewDocPI(xmlDocPtr doc, const xmlChar *name, const xmlChar *content) {
|
||||
xmlNodePtr cur;
|
||||
|
||||
if (name == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewPI : name == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -2169,10 +2106,6 @@ xmlNewNode(xmlNsPtr ns, const xmlChar *name) {
|
||||
xmlNodePtr cur;
|
||||
|
||||
if (name == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewNode : name == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -2211,10 +2144,6 @@ xmlNewNodeEatName(xmlNsPtr ns, xmlChar *name) {
|
||||
xmlNodePtr cur;
|
||||
|
||||
if (name == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewNode : name == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -2429,18 +2358,10 @@ xmlNewTextChild(xmlNodePtr parent, xmlNsPtr ns,
|
||||
xmlNodePtr cur, prev;
|
||||
|
||||
if (parent == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewTextChild : parent == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (name == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewTextChild : name == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -2809,18 +2730,10 @@ xmlNewChild(xmlNodePtr parent, xmlNsPtr ns,
|
||||
xmlNodePtr cur, prev;
|
||||
|
||||
if (parent == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewChild : parent == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (name == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewChild : name == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -2931,25 +2844,13 @@ xmlAddPropSibling(xmlNodePtr prev, xmlNodePtr cur, xmlNodePtr prop) {
|
||||
xmlNodePtr
|
||||
xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) {
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddNextSibling : cur == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
if (elem == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddNextSibling : elem == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (cur == elem) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddNextSibling : cur == elem\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -3008,25 +2909,13 @@ xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) {
|
||||
xmlNodePtr
|
||||
xmlAddPrevSibling(xmlNodePtr cur, xmlNodePtr elem) {
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddPrevSibling : cur == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
if (elem == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddPrevSibling : elem == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (cur == elem) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddPrevSibling : cur == elem\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -3086,26 +2975,14 @@ xmlAddSibling(xmlNodePtr cur, xmlNodePtr elem) {
|
||||
xmlNodePtr parent;
|
||||
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddSibling : cur == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (elem == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddSibling : elem == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (cur == elem) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddSibling : cur == elem\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -3162,27 +3039,15 @@ xmlAddChildList(xmlNodePtr parent, xmlNodePtr cur) {
|
||||
xmlNodePtr prev;
|
||||
|
||||
if (parent == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddChildList : parent == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddChildList : child == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if ((cur->doc != NULL) && (parent->doc != NULL) &&
|
||||
(cur->doc != parent->doc)) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Elements moved to a different document\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3248,26 +3113,14 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) {
|
||||
xmlNodePtr prev;
|
||||
|
||||
if (parent == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddChild : parent == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddChild : child == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (parent == cur) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlAddChild : parent == cur\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
/*
|
||||
@ -3370,10 +3223,6 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) {
|
||||
xmlNodePtr
|
||||
xmlGetLastChild(xmlNodePtr parent) {
|
||||
if (parent == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlGetLastChild : parent == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
return(parent->last);
|
||||
@ -3722,10 +3571,6 @@ xmlFreeNode(xmlNodePtr cur) {
|
||||
void
|
||||
xmlUnlinkNode(xmlNodePtr cur) {
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlUnlinkNode : node == NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (cur->type == XML_DTD_NODE) {
|
||||
@ -3797,10 +3642,6 @@ xmlNodePtr
|
||||
xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) {
|
||||
if (old == cur) return(NULL);
|
||||
if ((old == NULL) || (old->parent == NULL)) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlReplaceNode : old == NULL or without parent\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
if (cur == NULL) {
|
||||
@ -3811,17 +3652,9 @@ xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) {
|
||||
return(old);
|
||||
}
|
||||
if ((old->type==XML_ATTRIBUTE_NODE) && (cur->type!=XML_ATTRIBUTE_NODE)) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlReplaceNode : Trying to replace attribute node with other node type\n");
|
||||
#endif
|
||||
return(old);
|
||||
}
|
||||
if ((cur->type==XML_ATTRIBUTE_NODE) && (old->type!=XML_ATTRIBUTE_NODE)) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlReplaceNode : Trying to replace a non-attribute node with attribute node\n");
|
||||
#endif
|
||||
return(old);
|
||||
}
|
||||
xmlUnlinkNode(cur);
|
||||
@ -3874,10 +3707,6 @@ xmlCopyNamespace(xmlNsPtr cur) {
|
||||
ret = xmlNewNs(NULL, cur->href, cur->prefix);
|
||||
break;
|
||||
default:
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlCopyNamespace: invalid type %d\n", cur->type);
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
return(ret);
|
||||
@ -5439,10 +5268,6 @@ xmlNodeGetContent(xmlNodePtr cur)
|
||||
void
|
||||
xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) {
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNodeSetContent : node == NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
switch (cur->type) {
|
||||
@ -5513,10 +5338,6 @@ xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) {
|
||||
void
|
||||
xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNodeSetContentLen : node == NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
switch (cur->type) {
|
||||
@ -5584,10 +5405,6 @@ xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
|
||||
void
|
||||
xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNodeAddContentLen : node == NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (len <= 0) return;
|
||||
@ -5658,10 +5475,6 @@ xmlNodeAddContent(xmlNodePtr cur, const xmlChar *content) {
|
||||
int len;
|
||||
|
||||
if (cur == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNodeAddContent : node == NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (content == NULL) return;
|
||||
@ -6031,17 +5844,9 @@ xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
|
||||
int counter = 1;
|
||||
|
||||
if (tree == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewReconciliedNs : tree == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewReconciliedNs : ns == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
/*
|
||||
@ -6781,10 +6586,6 @@ xmlTextConcat(xmlNodePtr node, const xmlChar *content, int len) {
|
||||
(node->type != XML_CDATA_SECTION_NODE) &&
|
||||
(node->type != XML_COMMENT_NODE) &&
|
||||
(node->type != XML_PI_NODE)) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlTextConcat: node is not text nor CDATA\n");
|
||||
#endif
|
||||
return(-1);
|
||||
}
|
||||
/* need to check if content is currently in the dictionary */
|
||||
@ -6910,10 +6711,6 @@ void
|
||||
xmlBufferSetAllocationScheme(xmlBufferPtr buf,
|
||||
xmlBufferAllocationScheme scheme) {
|
||||
if (buf == NULL) {
|
||||
#ifdef DEBUG_BUFFER
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlBufferSetAllocationScheme: buf == NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) ||
|
||||
@ -6934,10 +6731,6 @@ xmlBufferSetAllocationScheme(xmlBufferPtr buf,
|
||||
void
|
||||
xmlBufferFree(xmlBufferPtr buf) {
|
||||
if (buf == NULL) {
|
||||
#ifdef DEBUG_BUFFER
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlBufferFree: buf == NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@ -7090,17 +6883,9 @@ xmlBufferDump(FILE *file, xmlBufferPtr buf) {
|
||||
int ret;
|
||||
|
||||
if (buf == NULL) {
|
||||
#ifdef DEBUG_BUFFER
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlBufferDump: buf == NULL\n");
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
if (buf->content == NULL) {
|
||||
#ifdef DEBUG_BUFFER
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlBufferDump: buf->content == NULL\n");
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
if (file == NULL)
|
||||
@ -7260,10 +7045,6 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
|
||||
}
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
|
||||
if (len < -1) {
|
||||
#ifdef DEBUG_BUFFER
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlBufferAdd: len < 0\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
if (len == 0) return 0;
|
||||
@ -7308,17 +7089,9 @@ xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) {
|
||||
return(-1);
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
|
||||
if (str == NULL) {
|
||||
#ifdef DEBUG_BUFFER
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlBufferAddHead: str == NULL\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
if (len < -1) {
|
||||
#ifdef DEBUG_BUFFER
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlBufferAddHead: len < 0\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
if (len == 0) return 0;
|
||||
@ -7394,10 +7167,6 @@ xmlBufferCCat(xmlBufferPtr buf, const char *str) {
|
||||
return(-1);
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
|
||||
if (str == NULL) {
|
||||
#ifdef DEBUG_BUFFER
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlBufferCCat: str == NULL\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
for (cur = str;*cur != 0;cur++) {
|
||||
@ -7463,10 +7232,6 @@ xmlBufferWriteQuotedString(xmlBufferPtr buf, const xmlChar *string) {
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return;
|
||||
if (xmlStrchr(string, '\"')) {
|
||||
if (xmlStrchr(string, '\'')) {
|
||||
#ifdef DEBUG_BUFFER
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlBufferWriteQuotedString: string contains quote and double-quotes !\n");
|
||||
#endif
|
||||
xmlBufferCCat(buf, "\"");
|
||||
base = cur = string;
|
||||
while(*cur != 0){
|
||||
|
@ -28,9 +28,6 @@
|
||||
|
||||
static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name,
|
||||
int create);
|
||||
/* #define DEBUG_VALID_ALGO */
|
||||
/* #define DEBUG_REGEXP_ALGO */
|
||||
|
||||
#define TODO \
|
||||
xmlGenericError(xmlGenericErrorContext, \
|
||||
"Unimplemented block at %s:%d\n", \
|
||||
|
@ -92,15 +92,7 @@
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/globals.h>
|
||||
|
||||
/* #define VERBOSE_FAILURE */
|
||||
/* #define DEBUG_EXTERNAL_ENTITIES */
|
||||
/* #define DEBUG_INPUT */
|
||||
|
||||
#ifdef DEBUG_INPUT
|
||||
#define MINLEN 40
|
||||
#else
|
||||
#define MINLEN 4000
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Input I/O callback sets
|
||||
@ -1644,11 +1636,6 @@ xmlParserInputBufferPush(xmlParserInputBufferPtr in,
|
||||
if (ret != 0)
|
||||
return(-1);
|
||||
}
|
||||
#ifdef DEBUG_INPUT
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"I/O: pushed %d chars, buffer %d/%d\n",
|
||||
nbchars, in->buffer->use, in->buffer->size);
|
||||
#endif
|
||||
return(nbchars);
|
||||
}
|
||||
|
||||
@ -1754,11 +1741,6 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
|
||||
in->buffer->use += nbchars;
|
||||
buffer[nbchars] = 0;
|
||||
}
|
||||
#ifdef DEBUG_INPUT
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"I/O: read %d chars, buffer %d/%d\n",
|
||||
nbchars, in->buffer->use, in->buffer->size);
|
||||
#endif
|
||||
return(nbchars);
|
||||
}
|
||||
|
||||
@ -1900,10 +1882,6 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID,
|
||||
xmlParserInputPtr ret = NULL;
|
||||
xmlChar *resource = NULL;
|
||||
|
||||
#ifdef DEBUG_EXTERNAL_ENTITIES
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlDefaultExternalEntityLoader(%s, xxx)\n", URL);
|
||||
#endif
|
||||
if ((ctxt != NULL) && (ctxt->options & XML_PARSE_NONET)) {
|
||||
int options = ctxt->options;
|
||||
|
||||
|
@ -29,20 +29,6 @@
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
/* #define DEBUG_MEMORY */
|
||||
|
||||
/**
|
||||
* MEM_LIST:
|
||||
*
|
||||
* keep track of all allocated blocks for error reporting
|
||||
* Always build the memory list !
|
||||
*/
|
||||
#ifdef DEBUG_MEMORY_LOCATION
|
||||
#ifndef MEM_LIST
|
||||
#define MEM_LIST /* keep a list of all the allocated memory blocks */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <libxml/globals.h> /* must come before xmlmemory.h */
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
@ -89,10 +75,6 @@ typedef struct memnod {
|
||||
unsigned int mh_type;
|
||||
unsigned long mh_number;
|
||||
size_t mh_size;
|
||||
#ifdef MEM_LIST
|
||||
struct memnod *mh_next;
|
||||
struct memnod *mh_prev;
|
||||
#endif
|
||||
const char *mh_file;
|
||||
unsigned int mh_line;
|
||||
} MEMHDR;
|
||||
@ -115,15 +97,8 @@ typedef struct memnod {
|
||||
static unsigned int block=0;
|
||||
static unsigned int xmlMemStopAtBlock = 0;
|
||||
static void *xmlMemTraceBlockAt = NULL;
|
||||
#ifdef MEM_LIST
|
||||
static MEMHDR *memlist = NULL;
|
||||
#endif
|
||||
|
||||
static void debugmem_tag_error(void *addr);
|
||||
#ifdef MEM_LIST
|
||||
static void debugmem_list_add(MEMHDR *);
|
||||
static void debugmem_list_delete(MEMHDR *);
|
||||
#endif
|
||||
#define Mem_Tag_Err(a) debugmem_tag_error(a);
|
||||
|
||||
#ifndef TEST_POINT
|
||||
@ -162,10 +137,6 @@ xmlMallocLoc(size_t size, const char * file, int line)
|
||||
void *ret;
|
||||
|
||||
if (!xmlMemInitialized) xmlInitMemory();
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Malloc(%d)\n",size);
|
||||
#endif
|
||||
|
||||
TEST_POINT
|
||||
|
||||
@ -187,15 +158,8 @@ xmlMallocLoc(size_t size, const char * file, int line)
|
||||
debugMemSize += size;
|
||||
debugMemBlocks++;
|
||||
if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
|
||||
#ifdef MEM_LIST
|
||||
debugmem_list_add(p);
|
||||
#endif
|
||||
xmlMutexUnlock(xmlMemMutex);
|
||||
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Malloc(%d) Ok\n",size);
|
||||
#endif
|
||||
|
||||
if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
|
||||
|
||||
@ -231,10 +195,6 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line)
|
||||
void *ret;
|
||||
|
||||
if (!xmlMemInitialized) xmlInitMemory();
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Malloc(%d)\n",size);
|
||||
#endif
|
||||
|
||||
TEST_POINT
|
||||
|
||||
@ -256,15 +216,8 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line)
|
||||
debugMemSize += size;
|
||||
debugMemBlocks++;
|
||||
if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
|
||||
#ifdef MEM_LIST
|
||||
debugmem_list_add(p);
|
||||
#endif
|
||||
xmlMutexUnlock(xmlMemMutex);
|
||||
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Malloc(%d) Ok\n",size);
|
||||
#endif
|
||||
|
||||
if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
|
||||
|
||||
@ -313,9 +266,6 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
|
||||
{
|
||||
MEMHDR *p;
|
||||
unsigned long number;
|
||||
#ifdef DEBUG_MEMORY
|
||||
size_t oldsize;
|
||||
#endif
|
||||
|
||||
if (ptr == NULL)
|
||||
return(xmlMallocLoc(size, file, line));
|
||||
@ -334,12 +284,6 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
|
||||
xmlMutexLock(xmlMemMutex);
|
||||
debugMemSize -= p->mh_size;
|
||||
debugMemBlocks--;
|
||||
#ifdef DEBUG_MEMORY
|
||||
oldsize = p->mh_size;
|
||||
#endif
|
||||
#ifdef MEM_LIST
|
||||
debugmem_list_delete(p);
|
||||
#endif
|
||||
xmlMutexUnlock(xmlMemMutex);
|
||||
|
||||
p = (MEMHDR *) realloc(p,RESERVE_SIZE+size);
|
||||
@ -363,17 +307,10 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
|
||||
debugMemSize += size;
|
||||
debugMemBlocks++;
|
||||
if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
|
||||
#ifdef MEM_LIST
|
||||
debugmem_list_add(p);
|
||||
#endif
|
||||
xmlMutexUnlock(xmlMemMutex);
|
||||
|
||||
TEST_POINT
|
||||
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Realloced(%d to %d) Ok\n", oldsize, size);
|
||||
#endif
|
||||
return(HDR_2_CLIENT(p));
|
||||
|
||||
error:
|
||||
@ -406,9 +343,6 @@ xmlMemFree(void *ptr)
|
||||
{
|
||||
MEMHDR *p;
|
||||
char *target;
|
||||
#ifdef DEBUG_MEMORY
|
||||
size_t size;
|
||||
#endif
|
||||
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
@ -440,22 +374,12 @@ xmlMemFree(void *ptr)
|
||||
xmlMutexLock(xmlMemMutex);
|
||||
debugMemSize -= p->mh_size;
|
||||
debugMemBlocks--;
|
||||
#ifdef DEBUG_MEMORY
|
||||
size = p->mh_size;
|
||||
#endif
|
||||
#ifdef MEM_LIST
|
||||
debugmem_list_delete(p);
|
||||
#endif
|
||||
xmlMutexUnlock(xmlMemMutex);
|
||||
|
||||
free(p);
|
||||
|
||||
TEST_POINT
|
||||
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Freed(%d) Ok\n", size);
|
||||
#endif
|
||||
|
||||
return;
|
||||
|
||||
@ -501,9 +425,6 @@ xmlMemStrdupLoc(const char *str, const char *file, int line)
|
||||
debugMemSize += size;
|
||||
debugMemBlocks++;
|
||||
if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
|
||||
#ifdef MEM_LIST
|
||||
debugmem_list_add(p);
|
||||
#endif
|
||||
xmlMutexUnlock(xmlMemMutex);
|
||||
|
||||
s = (char *) HDR_2_CLIENT(p);
|
||||
@ -569,66 +490,6 @@ xmlMemBlocks(void) {
|
||||
return(debugMemBlocks);
|
||||
}
|
||||
|
||||
#ifdef MEM_LIST
|
||||
/**
|
||||
* xmlMemContentShow:
|
||||
* @fp: a FILE descriptor used as the output file
|
||||
* @p: a memory block header
|
||||
*
|
||||
* tries to show some content from the memory block
|
||||
*/
|
||||
|
||||
static void
|
||||
xmlMemContentShow(FILE *fp, MEMHDR *p)
|
||||
{
|
||||
int i,j,k,len = p->mh_size;
|
||||
const char *buf = (const char *) HDR_2_CLIENT(p);
|
||||
|
||||
if (p == NULL) {
|
||||
fprintf(fp, " NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0;i < len;i++) {
|
||||
if (buf[i] == 0) break;
|
||||
if (!isprint((unsigned char) buf[i])) break;
|
||||
}
|
||||
if ((i < 4) && ((buf[i] != 0) || (i == 0))) {
|
||||
if (len >= 4) {
|
||||
MEMHDR *q;
|
||||
void *cur;
|
||||
|
||||
for (j = 0;(j < len -3) && (j < 40);j += 4) {
|
||||
cur = *((void **) &buf[j]);
|
||||
q = CLIENT_2_HDR(cur);
|
||||
p = memlist;
|
||||
k = 0;
|
||||
while (p != NULL) {
|
||||
if (p == q) break;
|
||||
p = p->mh_next;
|
||||
if (k++ > 100) break;
|
||||
}
|
||||
if ((p != NULL) && (p == q)) {
|
||||
fprintf(fp, " pointer to #%lu at index %d",
|
||||
p->mh_number, j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ((i == 0) && (buf[i] == 0)) {
|
||||
fprintf(fp," null");
|
||||
} else {
|
||||
if (buf[i] == 0) fprintf(fp," \"%.25s\"", buf);
|
||||
else {
|
||||
fprintf(fp," [");
|
||||
for (j = 0;j < i;j++)
|
||||
fprintf(fp,"%c", buf[j]);
|
||||
fprintf(fp,"]");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlMemDisplayLast:
|
||||
* @fp: a FILE descriptor used as the output file, if NULL, the result is
|
||||
@ -642,11 +503,6 @@ xmlMemContentShow(FILE *fp, MEMHDR *p)
|
||||
void
|
||||
xmlMemDisplayLast(FILE *fp, long nbBytes)
|
||||
{
|
||||
#ifdef MEM_LIST
|
||||
MEMHDR *p;
|
||||
unsigned idx;
|
||||
int nb = 0;
|
||||
#endif
|
||||
FILE *old_fp = fp;
|
||||
|
||||
if (nbBytes <= 0)
|
||||
@ -658,46 +514,7 @@ xmlMemDisplayLast(FILE *fp, long nbBytes)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MEM_LIST
|
||||
fprintf(fp," Last %li MEMORY ALLOCATED : %lu, MAX was %lu\n",
|
||||
nbBytes, debugMemSize, debugMaxMemSize);
|
||||
fprintf(fp,"BLOCK NUMBER SIZE TYPE\n");
|
||||
idx = 0;
|
||||
xmlMutexLock(xmlMemMutex);
|
||||
p = memlist;
|
||||
while ((p) && (nbBytes > 0)) {
|
||||
fprintf(fp,"%-5u %6lu %6lu ",idx++,p->mh_number,
|
||||
(unsigned long)p->mh_size);
|
||||
switch (p->mh_type) {
|
||||
case STRDUP_TYPE:fprintf(fp,"strdup() in ");break;
|
||||
case MALLOC_TYPE:fprintf(fp,"malloc() in ");break;
|
||||
case REALLOC_TYPE:fprintf(fp,"realloc() in ");break;
|
||||
case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break;
|
||||
case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
|
||||
default:
|
||||
fprintf(fp,"Unknown memory block, may be corrupted");
|
||||
xmlMutexUnlock(xmlMemMutex);
|
||||
if (old_fp == NULL)
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
if (p->mh_file != NULL) fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
|
||||
if (p->mh_tag != MEMTAG)
|
||||
fprintf(fp," INVALID");
|
||||
nb++;
|
||||
if (nb < 100)
|
||||
xmlMemContentShow(fp, p);
|
||||
else
|
||||
fprintf(fp," skip");
|
||||
|
||||
fprintf(fp,"\n");
|
||||
nbBytes -= (unsigned long)p->mh_size;
|
||||
p = p->mh_next;
|
||||
}
|
||||
xmlMutexUnlock(xmlMemMutex);
|
||||
#else
|
||||
fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
|
||||
#endif
|
||||
if (old_fp == NULL)
|
||||
fclose(fp);
|
||||
}
|
||||
@ -713,16 +530,6 @@ xmlMemDisplayLast(FILE *fp, long nbBytes)
|
||||
void
|
||||
xmlMemDisplay(FILE *fp)
|
||||
{
|
||||
#ifdef MEM_LIST
|
||||
MEMHDR *p;
|
||||
unsigned idx;
|
||||
int nb = 0;
|
||||
#if defined(HAVE_LOCALTIME) && defined(HAVE_STRFTIME)
|
||||
time_t currentTime;
|
||||
char buf[500];
|
||||
struct tm * tstruct;
|
||||
#endif
|
||||
#endif
|
||||
FILE *old_fp = fp;
|
||||
|
||||
if (fp == NULL) {
|
||||
@ -731,86 +538,11 @@ xmlMemDisplay(FILE *fp)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MEM_LIST
|
||||
#if defined(HAVE_LOCALTIME) && defined(HAVE_STRFTIME)
|
||||
currentTime = time(NULL);
|
||||
tstruct = localtime(¤tTime);
|
||||
strftime(buf, sizeof(buf) - 1, "%I:%M:%S %p", tstruct);
|
||||
fprintf(fp," %s\n\n", buf);
|
||||
#endif
|
||||
|
||||
|
||||
fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n",
|
||||
debugMemSize, debugMaxMemSize);
|
||||
fprintf(fp,"BLOCK NUMBER SIZE TYPE\n");
|
||||
idx = 0;
|
||||
xmlMutexLock(xmlMemMutex);
|
||||
p = memlist;
|
||||
while (p) {
|
||||
fprintf(fp,"%-5u %6lu %6lu ",idx++,p->mh_number,
|
||||
(unsigned long)p->mh_size);
|
||||
switch (p->mh_type) {
|
||||
case STRDUP_TYPE:fprintf(fp,"strdup() in ");break;
|
||||
case MALLOC_TYPE:fprintf(fp,"malloc() in ");break;
|
||||
case REALLOC_TYPE:fprintf(fp,"realloc() in ");break;
|
||||
case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break;
|
||||
case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
|
||||
default:
|
||||
fprintf(fp,"Unknown memory block, may be corrupted");
|
||||
xmlMutexUnlock(xmlMemMutex);
|
||||
if (old_fp == NULL)
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
if (p->mh_file != NULL) fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
|
||||
if (p->mh_tag != MEMTAG)
|
||||
fprintf(fp," INVALID");
|
||||
nb++;
|
||||
if (nb < 100)
|
||||
xmlMemContentShow(fp, p);
|
||||
else
|
||||
fprintf(fp," skip");
|
||||
|
||||
fprintf(fp,"\n");
|
||||
p = p->mh_next;
|
||||
}
|
||||
xmlMutexUnlock(xmlMemMutex);
|
||||
#else
|
||||
fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
|
||||
#endif
|
||||
if (old_fp == NULL)
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
#ifdef MEM_LIST
|
||||
|
||||
static void debugmem_list_add(MEMHDR *p)
|
||||
{
|
||||
p->mh_next = memlist;
|
||||
p->mh_prev = NULL;
|
||||
if (memlist) memlist->mh_prev = p;
|
||||
memlist = p;
|
||||
#ifdef MEM_LIST_DEBUG
|
||||
if (stderr)
|
||||
Mem_Display(stderr);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void debugmem_list_delete(MEMHDR *p)
|
||||
{
|
||||
if (p->mh_next)
|
||||
p->mh_next->mh_prev = p->mh_prev;
|
||||
if (p->mh_prev)
|
||||
p->mh_prev->mh_next = p->mh_next;
|
||||
else memlist = p->mh_next;
|
||||
#ifdef MEM_LIST_DEBUG
|
||||
if (stderr)
|
||||
Mem_Display(stderr);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* debugmem_tag_error:
|
||||
*
|
||||
@ -821,15 +553,8 @@ static void debugmem_tag_error(void *p)
|
||||
{
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Memory tag error occurs :%p \n\t bye\n", p);
|
||||
#ifdef MEM_LIST
|
||||
if (stderr)
|
||||
xmlMemDisplay(stderr);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MEM_LIST
|
||||
static FILE *xmlMemoryDumpFile = NULL;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlMemShow:
|
||||
@ -843,40 +568,10 @@ static FILE *xmlMemoryDumpFile = NULL;
|
||||
void
|
||||
xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED)
|
||||
{
|
||||
#ifdef MEM_LIST
|
||||
MEMHDR *p;
|
||||
#endif
|
||||
|
||||
if (fp != NULL)
|
||||
fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n",
|
||||
debugMemSize, debugMaxMemSize);
|
||||
#ifdef MEM_LIST
|
||||
xmlMutexLock(xmlMemMutex);
|
||||
if (nr > 0) {
|
||||
fprintf(fp,"NUMBER SIZE TYPE WHERE\n");
|
||||
p = memlist;
|
||||
while ((p) && nr > 0) {
|
||||
fprintf(fp,"%6lu %6lu ",p->mh_number,(unsigned long)p->mh_size);
|
||||
switch (p->mh_type) {
|
||||
case STRDUP_TYPE:fprintf(fp,"strdup() in ");break;
|
||||
case MALLOC_TYPE:fprintf(fp,"malloc() in ");break;
|
||||
case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break;
|
||||
case REALLOC_TYPE:fprintf(fp,"realloc() in ");break;
|
||||
case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
|
||||
default:fprintf(fp," ??? in ");break;
|
||||
}
|
||||
if (p->mh_file != NULL)
|
||||
fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
|
||||
if (p->mh_tag != MEMTAG)
|
||||
fprintf(fp," INVALID");
|
||||
xmlMemContentShow(fp, p);
|
||||
fprintf(fp,"\n");
|
||||
nr--;
|
||||
p = p->mh_next;
|
||||
}
|
||||
}
|
||||
xmlMutexUnlock(xmlMemMutex);
|
||||
#endif /* MEM_LIST */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -888,20 +583,6 @@ xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED)
|
||||
void
|
||||
xmlMemoryDump(void)
|
||||
{
|
||||
#ifdef MEM_LIST
|
||||
FILE *dump;
|
||||
|
||||
if (debugMaxMemSize == 0)
|
||||
return;
|
||||
dump = fopen(".memdump", "w");
|
||||
if (dump == NULL)
|
||||
xmlMemoryDumpFile = stderr;
|
||||
else xmlMemoryDumpFile = dump;
|
||||
|
||||
xmlMemDisplay(xmlMemoryDumpFile);
|
||||
|
||||
if (dump != NULL) fclose(dump);
|
||||
#endif /* MEM_LIST */
|
||||
}
|
||||
|
||||
|
||||
@ -923,10 +604,6 @@ xmlInitMemory(void)
|
||||
{
|
||||
#ifdef HAVE_STDLIB_H
|
||||
char *breakpoint;
|
||||
#endif
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlInitMemory()\n");
|
||||
#endif
|
||||
/*
|
||||
This is really not good code (see Bug 130419). Suggestions for
|
||||
@ -949,10 +626,6 @@ xmlInitMemory(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlInitMemory() Ok\n");
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -964,20 +637,12 @@ xmlInitMemory(void)
|
||||
*/
|
||||
void
|
||||
xmlCleanupMemory(void) {
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlCleanupMemory()\n");
|
||||
#endif
|
||||
if (xmlMemInitialized == 0)
|
||||
return;
|
||||
|
||||
xmlFreeMutex(xmlMemMutex);
|
||||
xmlMemMutex = NULL;
|
||||
xmlMemInitialized = 0;
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlCleanupMemory() Ok\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -998,10 +663,6 @@ xmlCleanupMemory(void) {
|
||||
int
|
||||
xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
|
||||
xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc) {
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlMemSetup()\n");
|
||||
#endif
|
||||
if (freeFunc == NULL)
|
||||
return(-1);
|
||||
if (mallocFunc == NULL)
|
||||
@ -1015,10 +676,6 @@ xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
|
||||
xmlMallocAtomic = mallocFunc;
|
||||
xmlRealloc = reallocFunc;
|
||||
xmlMemStrdup = strdupFunc;
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlMemSetup() Ok\n");
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -1065,10 +722,6 @@ int
|
||||
xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
|
||||
xmlMallocFunc mallocAtomicFunc, xmlReallocFunc reallocFunc,
|
||||
xmlStrdupFunc strdupFunc) {
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlGcMemSetup()\n");
|
||||
#endif
|
||||
if (freeFunc == NULL)
|
||||
return(-1);
|
||||
if (mallocFunc == NULL)
|
||||
@ -1084,10 +737,6 @@ xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
|
||||
xmlMallocAtomic = mallocAtomicFunc;
|
||||
xmlRealloc = reallocFunc;
|
||||
xmlMemStrdup = strdupFunc;
|
||||
#ifdef DEBUG_MEMORY
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlGcMemSetup() Ok\n");
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -55,9 +55,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* #define DEBUG_CALLBACKS */
|
||||
/* #define DEBUG_READER */
|
||||
|
||||
/**
|
||||
* TODO:
|
||||
*
|
||||
@ -68,12 +65,6 @@
|
||||
"Unimplemented block at %s:%d\n", \
|
||||
__FILE__, __LINE__);
|
||||
|
||||
#ifdef DEBUG_READER
|
||||
#define DUMP_READER xmlTextReaderDebug(reader);
|
||||
#else
|
||||
#define DUMP_READER
|
||||
#endif
|
||||
|
||||
#define CHUNK_SIZE 512
|
||||
/************************************************************************
|
||||
* *
|
||||
@ -506,29 +497,6 @@ xmlTextReaderFreeDoc(xmlTextReaderPtr reader, xmlDocPtr cur) {
|
||||
* The reader core parser *
|
||||
* *
|
||||
************************************************************************/
|
||||
#ifdef DEBUG_READER
|
||||
static void
|
||||
xmlTextReaderDebug(xmlTextReaderPtr reader) {
|
||||
if ((reader == NULL) || (reader->ctxt == NULL)) {
|
||||
fprintf(stderr, "xmlTextReader NULL\n");
|
||||
return;
|
||||
}
|
||||
fprintf(stderr, "xmlTextReader: state %d depth %d ",
|
||||
reader->state, reader->depth);
|
||||
if (reader->node == NULL) {
|
||||
fprintf(stderr, "node = NULL\n");
|
||||
} else {
|
||||
fprintf(stderr, "node %s\n", reader->node->name);
|
||||
}
|
||||
fprintf(stderr, " input: base %d, cur %d, depth %d: ",
|
||||
reader->base, reader->cur, reader->ctxt->nodeNr);
|
||||
if (reader->input->buffer == NULL) {
|
||||
fprintf(stderr, "buffer is NULL\n");
|
||||
} else {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlTextReaderEntPush:
|
||||
@ -606,9 +574,6 @@ xmlTextReaderStartElement(void *ctx, const xmlChar *fullname,
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
xmlTextReaderPtr reader = ctxt->_private;
|
||||
|
||||
#ifdef DEBUG_CALLBACKS
|
||||
printf("xmlTextReaderStartElement(%s)\n", fullname);
|
||||
#endif
|
||||
if ((reader != NULL) && (reader->startElement != NULL)) {
|
||||
reader->startElement(ctx, fullname, atts);
|
||||
if ((ctxt->node != NULL) && (ctxt->input != NULL) &&
|
||||
@ -632,9 +597,6 @@ xmlTextReaderEndElement(void *ctx, const xmlChar *fullname) {
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
xmlTextReaderPtr reader = ctxt->_private;
|
||||
|
||||
#ifdef DEBUG_CALLBACKS
|
||||
printf("xmlTextReaderEndElement(%s)\n", fullname);
|
||||
#endif
|
||||
if ((reader != NULL) && (reader->endElement != NULL)) {
|
||||
reader->endElement(ctx, fullname);
|
||||
}
|
||||
@ -669,9 +631,6 @@ xmlTextReaderStartElementNs(void *ctx,
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
xmlTextReaderPtr reader = ctxt->_private;
|
||||
|
||||
#ifdef DEBUG_CALLBACKS
|
||||
printf("xmlTextReaderStartElementNs(%s)\n", localname);
|
||||
#endif
|
||||
if ((reader != NULL) && (reader->startElementNs != NULL)) {
|
||||
reader->startElementNs(ctx, localname, prefix, URI, nb_namespaces,
|
||||
namespaces, nb_attributes, nb_defaulted,
|
||||
@ -703,9 +662,6 @@ xmlTextReaderEndElementNs(void *ctx,
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
xmlTextReaderPtr reader = ctxt->_private;
|
||||
|
||||
#ifdef DEBUG_CALLBACKS
|
||||
printf("xmlTextReaderEndElementNs(%s)\n", localname);
|
||||
#endif
|
||||
if ((reader != NULL) && (reader->endElementNs != NULL)) {
|
||||
reader->endElementNs(ctx, localname, prefix, URI);
|
||||
}
|
||||
@ -726,9 +682,6 @@ xmlTextReaderCharacters(void *ctx, const xmlChar *ch, int len)
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
xmlTextReaderPtr reader = ctxt->_private;
|
||||
|
||||
#ifdef DEBUG_CALLBACKS
|
||||
printf("xmlTextReaderCharacters()\n");
|
||||
#endif
|
||||
if ((reader != NULL) && (reader->characters != NULL)) {
|
||||
reader->characters(ctx, ch, len);
|
||||
}
|
||||
@ -748,9 +701,6 @@ xmlTextReaderCDataBlock(void *ctx, const xmlChar *ch, int len)
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
xmlTextReaderPtr reader = ctxt->_private;
|
||||
|
||||
#ifdef DEBUG_CALLBACKS
|
||||
printf("xmlTextReaderCDataBlock()\n");
|
||||
#endif
|
||||
if ((reader != NULL) && (reader->cdataBlock != NULL)) {
|
||||
reader->cdataBlock(ctx, ch, len);
|
||||
}
|
||||
@ -990,10 +940,6 @@ xmlTextReaderRead(xmlTextReaderPtr reader) {
|
||||
if (reader->ctxt->wellFormed != 1)
|
||||
return(-1);
|
||||
|
||||
#ifdef DEBUG_READER
|
||||
fprintf(stderr, "\nREAD ");
|
||||
DUMP_READER
|
||||
#endif
|
||||
if (reader->mode == XML_TEXTREADER_MODE_INITIAL) {
|
||||
reader->mode = XML_TEXTREADER_MODE_INTERACTIVE;
|
||||
/*
|
||||
@ -1164,8 +1110,6 @@ get_next_node:
|
||||
reader->state = XML_TEXTREADER_BACKTRACK;
|
||||
|
||||
node_found:
|
||||
DUMP_READER
|
||||
|
||||
/*
|
||||
* If we are in the middle of a piece of CDATA make sure it's finished
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user