(libxml) Cleanups of DEBUG ifdefs

This commit is contained in:
twinaphex 2012-11-18 00:41:50 +01:00
parent 01369d69d1
commit 6abb9348ff
12 changed files with 0 additions and 1243 deletions

View File

@ -32,9 +32,6 @@
# define SIZE_T_MAX ((size_t)-1) # define SIZE_T_MAX ((size_t)-1)
#endif /* !SIZE_T_MAX */ #endif /* !SIZE_T_MAX */
/* #define DEBUG_SAX2 */
/* #define DEBUG_SAX2_TREE */
/** /**
* TODO: * TODO:
* *
@ -339,11 +336,6 @@ xmlSAX2InternalSubset(void *ctx, const xmlChar *name,
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlDtdPtr dtd; xmlDtdPtr dtd;
if (ctx == NULL) return; if (ctx == NULL) return;
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2InternalSubset(%s, %s, %s)\n",
name, ExternalID, SystemID);
#endif
if (ctxt->myDoc == NULL) if (ctxt->myDoc == NULL)
return; return;
@ -376,11 +368,6 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
{ {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if (ctx == NULL) return; if (ctx == NULL) return;
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2ExternalSubset(%s, %s, %s)\n",
name, ExternalID, SystemID);
#endif
if (((ExternalID != NULL) || (SystemID != NULL)) && if (((ExternalID != NULL) || (SystemID != NULL)) &&
(((ctxt->validate) || (ctxt->loadsubset != 0)) && (((ctxt->validate) || (ctxt->loadsubset != 0)) &&
(ctxt->wellFormed && ctxt->myDoc))) { (ctxt->wellFormed && ctxt->myDoc))) {
@ -504,11 +491,6 @@ xmlSAX2ResolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId
URI = xmlBuildURI(systemId, (const xmlChar *) base); URI = xmlBuildURI(systemId, (const xmlChar *) base);
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2ResolveEntity(%s, %s)\n", publicId, systemId);
#endif
ret = xmlLoadExternalEntity((const char *) URI, ret = xmlLoadExternalEntity((const char *) URI,
(const char *) publicId, ctxt); (const char *) publicId, ctxt);
if (URI != NULL) if (URI != NULL)
@ -532,10 +514,6 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name)
xmlEntityPtr ret = NULL; xmlEntityPtr ret = NULL;
if (ctx == NULL) return(NULL); if (ctx == NULL) return(NULL);
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2GetEntity(%s)\n", name);
#endif
if (ctxt->inSubset == 0) { if (ctxt->inSubset == 0) {
ret = xmlGetPredefinedEntity(name); ret = xmlGetPredefinedEntity(name);
@ -608,10 +586,6 @@ xmlSAX2GetParameterEntity(void *ctx, const xmlChar *name)
xmlEntityPtr ret; xmlEntityPtr ret;
if (ctx == NULL) return(NULL); if (ctx == NULL) return(NULL);
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2GetParameterEntity(%s)\n", name);
#endif
ret = xmlGetParameterEntity(ctxt->myDoc, name); ret = xmlGetParameterEntity(ctxt->myDoc, name);
return(ret); return(ret);
@ -637,11 +611,6 @@ xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type,
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if (ctx == NULL) return; 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) { if (ctxt->inSubset == 1) {
ent = xmlAddDocEntity(ctxt->myDoc, name, type, publicId, ent = xmlAddDocEntity(ctxt->myDoc, name, type, publicId,
systemId, content); systemId, content);
@ -711,11 +680,6 @@ xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
if ((ctxt == NULL) || (ctxt->myDoc == NULL)) if ((ctxt == NULL) || (ctxt->myDoc == NULL))
return; 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")) && if ((xmlStrEqual(fullname, BAD_CAST "xml:id")) &&
(type != XML_ATTRIBUTE_ID)) { (type != XML_ATTRIBUTE_ID)) {
/* /*
@ -769,10 +733,6 @@ xmlSAX2ElementDecl(void *ctx, const xmlChar * name, int type,
if ((ctxt == NULL) || (ctxt->myDoc == NULL)) if ((ctxt == NULL) || (ctxt->myDoc == NULL))
return; return;
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2ElementDecl(%s, %d, ...)\n", name, type);
#endif
if (ctxt->inSubset == 1) if (ctxt->inSubset == 1)
elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->intSubset,
@ -807,10 +767,6 @@ xmlSAX2NotationDecl(void *ctx, const xmlChar *name,
if ((ctxt == NULL) || (ctxt->myDoc == NULL)) if ((ctxt == NULL) || (ctxt->myDoc == NULL))
return; return;
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2NotationDecl(%s, %s, %s)\n", name, publicId, systemId);
#endif
if ((publicId == NULL) && (systemId == NULL)) { if ((publicId == NULL) && (systemId == NULL)) {
xmlFatalErrMsg(ctxt, XML_ERR_NOTATION_PROCESSING, xmlFatalErrMsg(ctxt, XML_ERR_NOTATION_PROCESSING,
@ -849,11 +805,6 @@ xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name,
xmlEntityPtr ent; xmlEntityPtr ent;
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if (ctx == NULL) return; 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) { if (ctxt->inSubset == 1) {
ent = xmlAddDocEntity(ctxt->myDoc, name, ent = xmlAddDocEntity(ctxt->myDoc, name,
XML_EXTERNAL_GENERAL_UNPARSED_ENTITY, XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
@ -913,10 +864,6 @@ void
xmlSAX2SetDocumentLocator(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED) xmlSAX2SetDocumentLocator(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED)
{ {
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */ /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2SetDocumentLocator()\n");
#endif
} }
/** /**
@ -933,10 +880,6 @@ xmlSAX2StartDocument(void *ctx)
if (ctx == NULL) return; if (ctx == NULL) return;
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2StartDocument()\n");
#endif
if (ctxt->html) { if (ctxt->html) {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"libxml2 built without HTML support\n"); "libxml2 built without HTML support\n");
@ -983,10 +926,6 @@ void
xmlSAX2EndDocument(void *ctx) xmlSAX2EndDocument(void *ctx)
{ {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2EndDocument()\n");
#endif
if (ctx == NULL) return; if (ctx == NULL) return;
/* /*
@ -1518,18 +1457,10 @@ xmlSAX2Reference(void *ctx, const xmlChar *name)
xmlNodePtr ret; xmlNodePtr ret;
if (ctx == NULL) return; if (ctx == NULL) return;
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2Reference(%s)\n", name);
#endif
if (name[0] == '#') if (name[0] == '#')
ret = xmlNewCharRef(ctxt->myDoc, name); ret = xmlNewCharRef(ctxt->myDoc, name);
else else
ret = xmlNewReference(ctxt->myDoc, name); 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) { if (xmlAddChild(ctxt->node, ret) == NULL) {
xmlFreeNode(ret); xmlFreeNode(ret);
} }
@ -1550,10 +1481,6 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len)
xmlNodePtr lastChild; xmlNodePtr lastChild;
if (ctx == NULL) return; 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 * Handle the data if any. If there is no child
* add it as content, otherwise if the last child is text, * 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) { if (ctxt->node == NULL) {
#ifdef DEBUG_SAX_TREE
xmlGenericError(xmlGenericErrorContext,
"add chars: ctxt->node == NULL !\n");
#endif
return; return;
} }
lastChild = ctxt->node->last; 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 * 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) xmlSAX2IgnorableWhitespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED)
{ {
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */ /* 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; if (ctx == NULL) return;
parent = ctxt->node; parent = ctxt->node;
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2ProcessingInstruction(%s, %s)\n", target, data);
#endif
ret = xmlNewDocPI(ctxt->myDoc, target, data); ret = xmlNewDocPI(ctxt->myDoc, target, data);
if (ret == NULL) return; if (ret == NULL) return;
@ -1719,25 +1630,12 @@ xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target,
return; return;
} }
if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { 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); xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
return; return;
} }
if (parent->type == XML_ELEMENT_NODE) { 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); xmlAddChild(parent, ret);
} else { } else {
#ifdef DEBUG_SAX_TREE
xmlGenericError(xmlGenericErrorContext,
"adding PI %s sibling to ", target);
xmlDebugDumpOneNode(stderr, parent, 0);
#endif
xmlAddSibling(parent, ret); xmlAddSibling(parent, ret);
} }
} }
@ -1758,9 +1656,6 @@ xmlSAX2Comment(void *ctx, const xmlChar *value)
if (ctx == NULL) return; if (ctx == NULL) return;
parent = ctxt->node; parent = ctxt->node;
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2Comment(%s)\n", value);
#endif
ret = xmlNewDocComment(ctxt->myDoc, value); ret = xmlNewDocComment(ctxt->myDoc, value);
if (ret == NULL) return; if (ret == NULL) return;
if (ctxt->linenumbers) { if (ctxt->linenumbers) {
@ -1780,25 +1675,12 @@ xmlSAX2Comment(void *ctx, const xmlChar *value)
return; return;
} }
if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { 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); xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
return; return;
} }
if (parent->type == XML_ELEMENT_NODE) { if (parent->type == XML_ELEMENT_NODE) {
#ifdef DEBUG_SAX_TREE
xmlGenericError(xmlGenericErrorContext,
"adding xmlSAX2Comment child to %s\n", parent->name);
#endif
xmlAddChild(parent, ret); xmlAddChild(parent, ret);
} else { } else {
#ifdef DEBUG_SAX_TREE
xmlGenericError(xmlGenericErrorContext,
"adding xmlSAX2Comment sibling to ");
xmlDebugDumpOneNode(stderr, parent, 0);
#endif
xmlAddSibling(parent, ret); xmlAddSibling(parent, ret);
} }
} }
@ -1818,15 +1700,7 @@ xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len)
xmlNodePtr ret, lastChild; xmlNodePtr ret, lastChild;
if (ctx == NULL) return; if (ctx == NULL) return;
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.pcdata(%.10s, %d)\n", value, len);
#endif
lastChild = xmlGetLastChild(ctxt->node); lastChild = xmlGetLastChild(ctxt->node);
#ifdef DEBUG_SAX_TREE
xmlGenericError(xmlGenericErrorContext,
"add chars to %s \n", ctxt->node->name);
#endif
if ((lastChild != NULL) && if ((lastChild != NULL) &&
(lastChild->type == XML_CDATA_SECTION_NODE)) { (lastChild->type == XML_CDATA_SECTION_NODE)) {
xmlTextConcat(lastChild, value, len); xmlTextConcat(lastChild, value, len);

View File

@ -57,9 +57,6 @@ typedef unsigned __int32 uint32_t;
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/globals.h> #include <libxml/globals.h>
/* #define DEBUG_GROW */
/* #define DICT_DEBUG_PATTERNS */
#define MAX_HASH_LEN 3 #define MAX_HASH_LEN 3
#define MIN_DICT_SIZE 128 #define MIN_DICT_SIZE 128
#define MAX_DICT_HASH 8 * 2048 #define MAX_DICT_HASH 8 * 2048
@ -187,9 +184,6 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, int namelen) {
const xmlChar *ret; const xmlChar *ret;
int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */ int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */
#ifdef DICT_DEBUG_PATTERNS
fprintf(stderr, "-");
#endif
pool = dict->strings; pool = dict->strings;
while (pool != NULL) { while (pool != NULL) {
if (pool->end - pool->free > namelen) if (pool->end - pool->free > namelen)
@ -214,9 +208,6 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, int namelen) {
pool->end = &pool->array[size]; pool->end = &pool->array[size];
pool->next = dict->strings; pool->next = dict->strings;
dict->strings = pool; dict->strings = pool;
#ifdef DICT_DEBUG_PATTERNS
fprintf(stderr, "+");
#endif
} }
found_pool: found_pool:
ret = pool->free; ret = pool->free;
@ -249,9 +240,6 @@ xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, int plen,
if (prefix == NULL) return(xmlDictAddString(dict, name, namelen)); if (prefix == NULL) return(xmlDictAddString(dict, name, namelen));
#ifdef DICT_DEBUG_PATTERNS
fprintf(stderr, "=");
#endif
pool = dict->strings; pool = dict->strings;
while (pool != NULL) { while (pool != NULL) {
if (pool->end - pool->free > namelen + plen + 1) 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->end = &pool->array[size];
pool->next = dict->strings; pool->next = dict->strings;
dict->strings = pool; dict->strings = pool;
#ifdef DICT_DEBUG_PATTERNS
fprintf(stderr, "+");
#endif
} }
found_pool: found_pool:
ret = pool->free; ret = pool->free;
@ -472,9 +457,6 @@ xmlDictCreate(void) {
if (!xmlInitializeDict()) if (!xmlInitializeDict())
return(NULL); return(NULL);
#ifdef DICT_DEBUG_PATTERNS
fprintf(stderr, "C");
#endif
dict = xmlMalloc(sizeof(xmlDict)); dict = xmlMalloc(sizeof(xmlDict));
if (dict) { if (dict) {
@ -515,9 +497,6 @@ xmlDictCreateSub(xmlDictPtr sub) {
xmlDictPtr dict = xmlDictCreate(); xmlDictPtr dict = xmlDictCreate();
if ((dict != NULL) && (sub != NULL)) { if ((dict != NULL) && (sub != NULL)) {
#ifdef DICT_DEBUG_PATTERNS
fprintf(stderr, "R");
#endif
dict->seed = sub->seed; dict->seed = sub->seed;
dict->subdict = sub; dict->subdict = sub;
xmlDictReference(dict->subdict); xmlDictReference(dict->subdict);
@ -561,9 +540,6 @@ xmlDictGrow(xmlDictPtr dict, int size) {
int oldsize, i; int oldsize, i;
xmlDictEntryPtr iter, next; xmlDictEntryPtr iter, next;
struct _xmlDictEntry *olddict; struct _xmlDictEntry *olddict;
#ifdef DEBUG_GROW
unsigned long nbElem = 0;
#endif
int ret = 0; int ret = 0;
int keep_keys = 1; int keep_keys = 1;
@ -574,9 +550,6 @@ xmlDictGrow(xmlDictPtr dict, int size) {
if (size > 8 * 2048) if (size > 8 * 2048)
return(-1); return(-1);
#ifdef DICT_DEBUG_PATTERNS
fprintf(stderr, "*");
#endif
oldsize = dict->size; oldsize = dict->size;
olddict = dict->dict; olddict = dict->dict;
@ -632,9 +605,6 @@ xmlDictGrow(xmlDictPtr dict, int size) {
ret = -1; ret = -1;
} }
} }
#ifdef DEBUG_GROW
nbElem++;
#endif
} }
for (i = 0; i < oldsize; i++) { for (i = 0; i < oldsize; i++) {
@ -663,9 +633,6 @@ xmlDictGrow(xmlDictPtr dict, int size) {
dict->dict[key].next = iter; dict->dict[key].next = iter;
} }
#ifdef DEBUG_GROW
nbElem++;
#endif
iter = next; iter = next;
} }
@ -673,10 +640,6 @@ xmlDictGrow(xmlDictPtr dict, int size) {
xmlFree(olddict); xmlFree(olddict);
#ifdef DEBUG_GROW
xmlGenericError(xmlGenericErrorContext,
"xmlDictGrow : from %d to %d, %d elems\n", oldsize, size, nbElem);
#endif
return(ret); return(ret);
} }

View File

@ -55,15 +55,9 @@ static xmlCharEncodingAliasPtr xmlCharEncodingAliases = NULL;
static int xmlCharEncodingAliasesNb = 0; static int xmlCharEncodingAliasesNb = 0;
static int xmlCharEncodingAliasesMax = 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 #ifdef LIBXML_ISO8859X_ENABLED
static void xmlRegisterCharEncodingHandlersISO8859x (void); static void xmlRegisterCharEncodingHandlersISO8859x (void);
#endif #endif
#endif
static int xmlLittleEndian = 1; 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, "SHIFT_JIS")) return(XML_CHAR_ENCODING_SHIFT_JIS);
if (!strcmp(upper, "EUC-JP")) return(XML_CHAR_ENCODING_EUC_JP); 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); return(XML_CHAR_ENCODING_ERROR);
} }
@ -873,10 +864,6 @@ xmlNewCharEncodingHandler(const char *name,
* registers and returns the handler. * registers and returns the handler.
*/ */
xmlRegisterCharEncodingHandler(handler); xmlRegisterCharEncodingHandler(handler);
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"Registered encoding handler for %s\n", name);
#endif
return(handler); return(handler);
} }
@ -1101,10 +1088,6 @@ xmlGetCharEncodingHandler(xmlCharEncoding enc) {
break; break;
} }
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"No handler found for encoding %d\n", enc);
#endif
return(NULL); return(NULL);
} }
@ -1152,10 +1135,6 @@ xmlFindCharEncodingHandler(const char *name) {
if (handlers != NULL) { if (handlers != NULL) {
for (i = 0;i < nbCharEncodingHandler; i++) { for (i = 0;i < nbCharEncodingHandler; i++) {
if (!strcmp(upper, handlers[i]->name)) { if (!strcmp(upper, handlers[i]->name)) {
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"Found registered handler for encoding %s\n", name);
#endif
return(handlers[i]); return(handlers[i]);
} }
} }
@ -1185,10 +1164,6 @@ xmlFindCharEncodingHandler(const char *name) {
enc->output = NULL; enc->output = NULL;
enc->iconv_in = icv_in; enc->iconv_in = icv_in;
enc->iconv_out = icv_out; enc->iconv_out = icv_out;
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"Found iconv handler for encoding %s\n", name);
#endif
return enc; return enc;
} else if ((icv_in != (iconv_t) -1) || icv_out != (iconv_t) -1) { } else if ((icv_in != (iconv_t) -1) || icv_out != (iconv_t) -1) {
xmlEncodingErr(XML_ERR_INTERNAL_ERROR, xmlEncodingErr(XML_ERR_INTERNAL_ERROR,
@ -1196,11 +1171,6 @@ xmlFindCharEncodingHandler(const char *name) {
} }
#endif /* LIBXML_ICONV_ENABLED */ #endif /* LIBXML_ICONV_ENABLED */
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"No handler found for encoding %s\n", name);
#endif
/* /*
* Fallback using the canonical names * Fallback using the canonical names
*/ */
@ -1358,29 +1328,6 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
if (ret == -1) ret = -3; if (ret == -1) ret = -3;
} }
#endif /* LIBXML_ICONV_ENABLED */ #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 * Ignore when input buffer is not on a boundary
*/ */
@ -1465,25 +1412,10 @@ xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out,
#endif /* LIBXML_ICONV_ENABLED */ #endif /* LIBXML_ICONV_ENABLED */
switch (ret) { switch (ret) {
case 0: case 0:
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"converted %d bytes to %d bytes of input\n",
toconv, written);
#endif
break; break;
case -1: case -1:
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"converted %d bytes to %d bytes of input, %d left\n",
toconv, written, in->use);
#endif
break; break;
case -3: case -3:
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"converted %d bytes to %d bytes of input, %d left\n",
toconv, written, in->use);
#endif
break; break;
case -2: { case -2: {
char buf[50]; char buf[50];
@ -1563,10 +1495,6 @@ retry:
out->content[out->use] = 0; out->content[out->use] = 0;
} }
#endif /* LIBXML_ICONV_ENABLED */ #endif /* LIBXML_ICONV_ENABLED */
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"initialized encoder\n");
#endif
return(0); return(0);
} }
@ -1622,23 +1550,10 @@ retry:
*/ */
switch (ret) { switch (ret) {
case 0: case 0:
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"converted %d bytes to %d bytes of output\n",
toconv, written);
#endif
break; break;
case -1: case -1:
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"output conversion failed by lack of space\n");
#endif
break; break;
case -3: case -3:
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of output %d left\n",
toconv, written, in->use);
#endif
break; break;
case -2: { case -2: {
int len = in->use; int len = in->use;
@ -1649,14 +1564,6 @@ retry:
if (cur > 0) { if (cur > 0) {
xmlChar charref[20]; 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 * Removes the UTF8 sequence, and replace it by a charref
* and continue the transcoding phase, hoping the error * and continue the transcoding phase, hoping the error
@ -1726,14 +1633,6 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
handler->name = NULL; handler->name = NULL;
xmlFree(handler); 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); return(ret);
} }

View File

@ -23,8 +23,6 @@
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/threads.h> #include <libxml/threads.h>
/* #define DEBUG_GLOBALS */
/* /*
* Helpful Macro * Helpful Macro
*/ */
@ -75,13 +73,6 @@ void xmlCleanupGlobals(void)
#undef xmlMemStrdup #undef xmlMemStrdup
#undef xmlRealloc #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: * xmlFree:
* @mem: an already allocated block of memory * @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 * Returns the copy of the string or NULL in case of error
*/ */
xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup; xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
#endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
#include <libxml/threads.h> #include <libxml/threads.h>
#include <libxml/globals.h> #include <libxml/globals.h>
@ -375,11 +365,6 @@ xmlSAXLocator xmlDefaultSAXLocator = {
void void
xmlInitializeGlobalState(xmlGlobalStatePtr gs) 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 * Perform initialization as required by libxml
*/ */
@ -397,19 +382,11 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber; gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
gs->xmlDoValidityCheckingDefaultValue = gs->xmlDoValidityCheckingDefaultValue =
xmlDoValidityCheckingDefaultValueThrDef; 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->xmlFree = (xmlFreeFunc) free;
gs->xmlMalloc = (xmlMallocFunc) malloc; gs->xmlMalloc = (xmlMallocFunc) malloc;
gs->xmlMallocAtomic = (xmlMallocFunc) malloc; gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
gs->xmlRealloc = (xmlReallocFunc) realloc; gs->xmlRealloc = (xmlReallocFunc) realloc;
gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup; gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
#endif
gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef; gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef; gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
gs->xmlTreeIndentString = xmlTreeIndentStringThrDef; gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;

View File

@ -45,8 +45,6 @@
#define MAX_HASH_LEN 8 #define MAX_HASH_LEN 8
/* #define DEBUG_GROW */
#ifdef HASH_RANDOMIZATION #ifdef HASH_RANDOMIZATION
static int hash_initialized = 0; static int hash_initialized = 0;
#endif #endif
@ -235,9 +233,6 @@ xmlHashGrow(xmlHashTablePtr table, int size) {
int oldsize, i; int oldsize, i;
xmlHashEntryPtr iter, next; xmlHashEntryPtr iter, next;
struct _xmlHashEntry *oldtable; struct _xmlHashEntry *oldtable;
#ifdef DEBUG_GROW
unsigned long nbElem = 0;
#endif
if (table == NULL) if (table == NULL)
return(-1); return(-1);
@ -294,9 +289,6 @@ xmlHashGrow(xmlHashTablePtr table, int size) {
table->table[key].next = iter; table->table[key].next = iter;
} }
#ifdef DEBUG_GROW
nbElem++;
#endif
iter = next; iter = next;
} }
@ -304,10 +296,6 @@ xmlHashGrow(xmlHashTablePtr table, int size) {
xmlFree(oldtable); xmlFree(oldtable);
#ifdef DEBUG_GROW
xmlGenericError(xmlGenericErrorContext,
"xmlHashGrow : from %d to %d, %d elems\n", oldsize, size, nbElem);
#endif
return(0); return(0);
} }

View File

@ -837,11 +837,7 @@ xmlHasFeature(xmlFeature feature)
case XML_WITH_DEBUG: case XML_WITH_DEBUG:
return(0); return(0);
case XML_WITH_DEBUG_MEM: case XML_WITH_DEBUG_MEM:
#ifdef DEBUG_MEMORY_LOCATION
return(1);
#else
return(0); return(0);
#endif
case XML_WITH_DEBUG_RUN: case XML_WITH_DEBUG_RUN:
return(0); return(0);
case XML_WITH_ZLIB: case XML_WITH_ZLIB:
@ -2949,14 +2945,6 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
* Routines to parse Name, NCName and NmToken * * 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 * The two following functions are related to the change of accepted
@ -3047,10 +3035,6 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
int c; int c;
int count = 0; int count = 0;
#ifdef DEBUG
nbParseNameComplex++;
#endif
/* /*
* Handler for more complex cases * Handler for more complex cases
*/ */
@ -3165,10 +3149,6 @@ xmlParseName(xmlParserCtxtPtr ctxt) {
GROW; GROW;
#ifdef DEBUG
nbParseName++;
#endif
/* /*
* Accelerator for simple ASCII names * Accelerator for simple ASCII names
*/ */
@ -3204,10 +3184,6 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
int c; int c;
int count = 0; int count = 0;
#ifdef DEBUG
nbParseNCNameComplex++;
#endif
/* /*
* Handler for more complex cases * Handler for more complex cases
*/ */
@ -3252,10 +3228,6 @@ xmlParseNCName(xmlParserCtxtPtr ctxt) {
const xmlChar *ret; const xmlChar *ret;
int count = 0; int count = 0;
#ifdef DEBUG
nbParseNCName++;
#endif
/* /*
* Accelerator for simple ASCII names * Accelerator for simple ASCII names
*/ */
@ -3349,10 +3321,6 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
int len = 0, l; int len = 0, l;
int c; int c;
#ifdef DEBUG
nbParseStringName++;
#endif
c = CUR_SCHAR(cur, l); c = CUR_SCHAR(cur, l);
if (!xmlIsNameStartChar(ctxt, c)) { if (!xmlIsNameStartChar(ctxt, c)) {
return(NULL); return(NULL);
@ -3425,10 +3393,6 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
int c; int c;
int count = 0; int count = 0;
#ifdef DEBUG
nbParseNmToken++;
#endif
GROW; GROW;
c = CUR_CHAR(l); c = CUR_CHAR(l);
@ -9986,35 +9950,10 @@ xmlParseLookupSequence(xmlParserCtxtPtr ctxt, xmlChar first,
if (buf[base + 1] != next) continue; if (buf[base + 1] != next) continue;
} }
ctxt->checkIndex = 0; 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)); return(base - (in->cur - in->base));
} }
} }
ctxt->checkIndex = 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); return(-1);
} }
@ -10161,59 +10100,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if (ctxt->input == NULL) if (ctxt->input == NULL)
return(0); 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) && if ((ctxt->input != NULL) &&
(ctxt->input->cur - ctxt->input->base > 4096)) { (ctxt->input->cur - ctxt->input->base > 4096)) {
xmlSHRINK(ctxt); xmlSHRINK(ctxt);
@ -10303,10 +10189,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
&xmlDefaultSAXLocator); &xmlDefaultSAXLocator);
xmlFatalErr(ctxt, XML_ERR_DOCUMENT_EMPTY, NULL); xmlFatalErr(ctxt, XML_ERR_DOCUMENT_EMPTY, NULL);
ctxt->instate = XML_PARSER_EOF; ctxt->instate = XML_PARSER_EOF;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering EOF\n");
#endif
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
ctxt->sax->endDocument(ctxt->userData); ctxt->sax->endDocument(ctxt->userData);
goto done; goto done;
@ -10325,10 +10207,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
(ctxt->input->cur[4] == 'l') && (ctxt->input->cur[4] == 'l') &&
(IS_BLANK_CH(ctxt->input->cur[5]))) { (IS_BLANK_CH(ctxt->input->cur[5]))) {
ret += 5; ret += 5;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: Parsing XML Decl\n");
#endif
xmlParseXMLDecl(ctxt); xmlParseXMLDecl(ctxt);
if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
/* /*
@ -10346,20 +10224,12 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
(!ctxt->disableSAX)) (!ctxt->disableSAX))
ctxt->sax->startDocument(ctxt->userData); ctxt->sax->startDocument(ctxt->userData);
ctxt->instate = XML_PARSER_MISC; ctxt->instate = XML_PARSER_MISC;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering MISC\n");
#endif
} else { } else {
ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION); ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION);
if ((ctxt->sax) && (ctxt->sax->startDocument) && if ((ctxt->sax) && (ctxt->sax->startDocument) &&
(!ctxt->disableSAX)) (!ctxt->disableSAX))
ctxt->sax->startDocument(ctxt->userData); ctxt->sax->startDocument(ctxt->userData);
ctxt->instate = XML_PARSER_MISC; ctxt->instate = XML_PARSER_MISC;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering MISC\n");
#endif
} }
} else { } else {
if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
@ -10374,10 +10244,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
(!ctxt->disableSAX)) (!ctxt->disableSAX))
ctxt->sax->startDocument(ctxt->userData); ctxt->sax->startDocument(ctxt->userData);
ctxt->instate = XML_PARSER_MISC; ctxt->instate = XML_PARSER_MISC;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering MISC\n");
#endif
} }
break; break;
case XML_PARSER_START_TAG: { case XML_PARSER_START_TAG: {
@ -10648,10 +10514,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
SKIPL(base + 3); SKIPL(base + 3);
ctxt->checkIndex = 0; ctxt->checkIndex = 0;
ctxt->instate = XML_PARSER_CONTENT; ctxt->instate = XML_PARSER_CONTENT;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering CONTENT\n");
#endif
} }
break; break;
} }
@ -10671,10 +10533,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(xmlParseLookupSequence(ctxt, '?', '>', 0) < 0)) (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: Parsing PI\n");
#endif
xmlParsePI(ctxt); xmlParsePI(ctxt);
ctxt->checkIndex = 0; ctxt->checkIndex = 0;
} else if ((cur == '<') && (next == '!') && } else if ((cur == '<') && (next == '!') &&
@ -10683,10 +10541,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(xmlParseLookupSequence(ctxt, '-', '-', '>') < 0)) (xmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: Parsing Comment\n");
#endif
xmlParseComment(ctxt); xmlParseComment(ctxt);
ctxt->instate = XML_PARSER_MISC; ctxt->instate = XML_PARSER_MISC;
ctxt->checkIndex = 0; ctxt->checkIndex = 0;
@ -10701,18 +10555,10 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(xmlParseLookupSequence(ctxt, '>', 0, 0) < 0)) (xmlParseLookupSequence(ctxt, '>', 0, 0) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: Parsing internal subset\n");
#endif
ctxt->inSubset = 1; ctxt->inSubset = 1;
xmlParseDocTypeDecl(ctxt); xmlParseDocTypeDecl(ctxt);
if (RAW == '[') { if (RAW == '[') {
ctxt->instate = XML_PARSER_DTD; ctxt->instate = XML_PARSER_DTD;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering DTD\n");
#endif
} else { } else {
/* /*
* Create and update the external subset. * Create and update the external subset.
@ -10726,10 +10572,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
ctxt->inSubset = 0; ctxt->inSubset = 0;
xmlCleanSpecialAttr(ctxt); xmlCleanSpecialAttr(ctxt);
ctxt->instate = XML_PARSER_PROLOG; ctxt->instate = XML_PARSER_PROLOG;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering PROLOG\n");
#endif
} }
} else if ((cur == '<') && (next == '!') && } else if ((cur == '<') && (next == '!') &&
(avail < 9)) { (avail < 9)) {
@ -10738,10 +10580,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
ctxt->instate = XML_PARSER_START_TAG; ctxt->instate = XML_PARSER_START_TAG;
ctxt->progressive = 1; ctxt->progressive = 1;
xmlParseGetLasts(ctxt, &lastlt, &lastgt); xmlParseGetLasts(ctxt, &lastlt, &lastgt);
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering START_TAG\n");
#endif
} }
break; break;
case XML_PARSER_PROLOG: case XML_PARSER_PROLOG:
@ -10758,20 +10596,12 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(xmlParseLookupSequence(ctxt, '?', '>', 0) < 0)) (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: Parsing PI\n");
#endif
xmlParsePI(ctxt); xmlParsePI(ctxt);
} else if ((cur == '<') && (next == '!') && } else if ((cur == '<') && (next == '!') &&
(ctxt->input->cur[2] == '-') && (ctxt->input->cur[3] == '-')) { (ctxt->input->cur[2] == '-') && (ctxt->input->cur[3] == '-')) {
if ((!terminate) && if ((!terminate) &&
(xmlParseLookupSequence(ctxt, '-', '-', '>') < 0)) (xmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: Parsing Comment\n");
#endif
xmlParseComment(ctxt); xmlParseComment(ctxt);
ctxt->instate = XML_PARSER_PROLOG; ctxt->instate = XML_PARSER_PROLOG;
} else if ((cur == '<') && (next == '!') && } else if ((cur == '<') && (next == '!') &&
@ -10782,10 +10612,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if (ctxt->progressive == 0) if (ctxt->progressive == 0)
ctxt->progressive = 1; ctxt->progressive = 1;
xmlParseGetLasts(ctxt, &lastlt, &lastgt); xmlParseGetLasts(ctxt, &lastlt, &lastgt);
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering START_TAG\n");
#endif
} }
break; break;
case XML_PARSER_EPILOG: case XML_PARSER_EPILOG:
@ -10802,10 +10628,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(xmlParseLookupSequence(ctxt, '?', '>', 0) < 0)) (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: Parsing PI\n");
#endif
xmlParsePI(ctxt); xmlParsePI(ctxt);
ctxt->instate = XML_PARSER_EPILOG; ctxt->instate = XML_PARSER_EPILOG;
} else if ((cur == '<') && (next == '!') && } else if ((cur == '<') && (next == '!') &&
@ -10813,10 +10635,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(xmlParseLookupSequence(ctxt, '-', '-', '>') < 0)) (xmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: Parsing Comment\n");
#endif
xmlParseComment(ctxt); xmlParseComment(ctxt);
ctxt->instate = XML_PARSER_EPILOG; ctxt->instate = XML_PARSER_EPILOG;
} else if ((cur == '<') && (next == '!') && } else if ((cur == '<') && (next == '!') &&
@ -10825,10 +10643,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
} else { } else {
xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL); xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL);
ctxt->instate = XML_PARSER_EOF; ctxt->instate = XML_PARSER_EOF;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering EOF\n");
#endif
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
ctxt->sax->endDocument(ctxt->userData); ctxt->sax->endDocument(ctxt->userData);
goto done; goto done;
@ -10937,11 +10751,6 @@ not_end_of_int_subset:
/* /*
* We didn't found the end of the Internal 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; goto done;
found_end_int_subset: found_end_int_subset:
@ -10955,90 +10764,51 @@ found_end_int_subset:
xmlCleanSpecialAttr(ctxt); xmlCleanSpecialAttr(ctxt);
ctxt->instate = XML_PARSER_PROLOG; ctxt->instate = XML_PARSER_PROLOG;
ctxt->checkIndex = 0; ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering PROLOG\n");
#endif
break; break;
} }
case XML_PARSER_COMMENT: case XML_PARSER_COMMENT:
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == COMMENT\n"); "PP: internal error, state == COMMENT\n");
ctxt->instate = XML_PARSER_CONTENT; ctxt->instate = XML_PARSER_CONTENT;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering CONTENT\n");
#endif
break; break;
case XML_PARSER_IGNORE: case XML_PARSER_IGNORE:
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == IGNORE"); "PP: internal error, state == IGNORE");
ctxt->instate = XML_PARSER_DTD; ctxt->instate = XML_PARSER_DTD;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering DTD\n");
#endif
break; break;
case XML_PARSER_PI: case XML_PARSER_PI:
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == PI\n"); "PP: internal error, state == PI\n");
ctxt->instate = XML_PARSER_CONTENT; ctxt->instate = XML_PARSER_CONTENT;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering CONTENT\n");
#endif
break; break;
case XML_PARSER_ENTITY_DECL: case XML_PARSER_ENTITY_DECL:
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == ENTITY_DECL\n"); "PP: internal error, state == ENTITY_DECL\n");
ctxt->instate = XML_PARSER_DTD; ctxt->instate = XML_PARSER_DTD;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering DTD\n");
#endif
break; break;
case XML_PARSER_ENTITY_VALUE: case XML_PARSER_ENTITY_VALUE:
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == ENTITY_VALUE\n"); "PP: internal error, state == ENTITY_VALUE\n");
ctxt->instate = XML_PARSER_CONTENT; ctxt->instate = XML_PARSER_CONTENT;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering DTD\n");
#endif
break; break;
case XML_PARSER_ATTRIBUTE_VALUE: case XML_PARSER_ATTRIBUTE_VALUE:
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == ATTRIBUTE_VALUE\n"); "PP: internal error, state == ATTRIBUTE_VALUE\n");
ctxt->instate = XML_PARSER_START_TAG; ctxt->instate = XML_PARSER_START_TAG;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering START_TAG\n");
#endif
break; break;
case XML_PARSER_SYSTEM_LITERAL: case XML_PARSER_SYSTEM_LITERAL:
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == SYSTEM_LITERAL\n"); "PP: internal error, state == SYSTEM_LITERAL\n");
ctxt->instate = XML_PARSER_START_TAG; ctxt->instate = XML_PARSER_START_TAG;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering START_TAG\n");
#endif
break; break;
case XML_PARSER_PUBLIC_LITERAL: case XML_PARSER_PUBLIC_LITERAL:
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == PUBLIC_LITERAL\n"); "PP: internal error, state == PUBLIC_LITERAL\n");
ctxt->instate = XML_PARSER_START_TAG; ctxt->instate = XML_PARSER_START_TAG;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering START_TAG\n");
#endif
break; break;
} }
} }
done: done:
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext, "PP: done %d\n", ret);
#endif
return(ret); return(ret);
encoding_error: encoding_error:
{ {
@ -11136,9 +10906,6 @@ xmldecl_done:
ctxt->input->cur = ctxt->input->base + cur; ctxt->input->cur = ctxt->input->base + cur;
ctxt->input->end = ctxt->input->end =
&ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->use]; &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) { } else if (ctxt->instate != XML_PARSER_EOF) {
if ((ctxt->input != NULL) && ctxt->input->buf != NULL) { 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->cur = ctxt->input->base + cur;
ctxt->input->end = ctxt->input->end =
&ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->use]; &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) { if (enc != XML_CHAR_ENCODING_NONE) {
@ -12709,9 +12473,6 @@ xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk,
ctxt->input->end = ctxt->input->end =
&ctxt->input->buf->buffer->content[ctxt->input->buf->buffer-> &ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->
use]; use];
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext, "PP: pushed %d\n", size);
#endif
} }
if (encoding != NULL) { if (encoding != NULL) {

View File

@ -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 */ /* we need to keep enough input to show errors in context */
#define LINE_LEN 80 #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) #define CHECK_BUFFER(in)
#endif
/** /**
@ -279,9 +250,6 @@ xmlParserInputRead(xmlParserInputPtr in, int len) {
int indx; int indx;
if (in == NULL) return(-1); if (in == NULL) return(-1);
#ifdef DEBUG_INPUT
xmlGenericError(xmlGenericErrorContext, "Read\n");
#endif
if (in->buf == NULL) return(-1); if (in->buf == NULL) return(-1);
if (in->base == NULL) return(-1); if (in->base == NULL) return(-1);
if (in->cur == NULL) return(-1); if (in->cur == NULL) return(-1);
@ -329,9 +297,6 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) {
int indx; int indx;
if (in == NULL) return(-1); if (in == NULL) return(-1);
#ifdef DEBUG_INPUT
xmlGenericError(xmlGenericErrorContext, "Grow\n");
#endif
if (in->buf == NULL) return(-1); if (in->buf == NULL) return(-1);
if (in->base == NULL) return(-1); if (in->base == NULL) return(-1);
if (in->cur == NULL) return(-1); if (in->cur == NULL) return(-1);
@ -384,9 +349,6 @@ xmlParserInputShrink(xmlParserInputPtr in) {
int ret; int ret;
int indx; int indx;
#ifdef DEBUG_INPUT
xmlGenericError(xmlGenericErrorContext, "Shrink\n");
#endif
if (in == NULL) return; if (in == NULL) return;
if (in->buf == NULL) return; if (in->buf == NULL) return;
if (in->base == NULL) return; if (in->base == NULL) return;

View File

@ -128,9 +128,6 @@ static int xmlCheckDTD = 1;
#define IS_STR_XML(str) ((str != NULL) && (str[0] == 'x') && \ #define IS_STR_XML(str) ((str != NULL) && (str[0] == 'x') && \
(str[1] == 'm') && (str[2] == 'l') && (str[3] == 0)) (str[1] == 'm') && (str[2] == 'l') && (str[3] == 0))
/* #define DEBUG_BUFFER */
/* #define DEBUG_TREE */
/************************************************************************ /************************************************************************
* * * *
* Functions to move to entities.c once the * * Functions to move to entities.c once the *
@ -784,10 +781,6 @@ xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix) {
void void
xmlSetNs(xmlNodePtr node, xmlNsPtr ns) { xmlSetNs(xmlNodePtr node, xmlNsPtr ns) {
if (node == NULL) { if (node == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlSetNs: node == NULL\n");
#endif
return; return;
} }
node->ns = ns; node->ns = ns;
@ -802,10 +795,6 @@ xmlSetNs(xmlNodePtr node, xmlNsPtr ns) {
void void
xmlFreeNs(xmlNsPtr cur) { xmlFreeNs(xmlNsPtr cur) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlFreeNs : ns == NULL\n");
#endif
return; return;
} }
if (cur->href != NULL) xmlFree((char *) cur->href); if (cur->href != NULL) xmlFree((char *) cur->href);
@ -823,10 +812,6 @@ void
xmlFreeNsList(xmlNsPtr cur) { xmlFreeNsList(xmlNsPtr cur) {
xmlNsPtr next; xmlNsPtr next;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlFreeNsList : ns == NULL\n");
#endif
return; return;
} }
while (cur != NULL) { while (cur != NULL) {
@ -854,12 +839,6 @@ xmlNewDtd(xmlDocPtr doc, const xmlChar *name,
xmlDtdPtr cur; xmlDtdPtr cur;
if ((doc != NULL) && (doc->extSubset != NULL)) { 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); return(NULL);
} }
@ -928,12 +907,6 @@ xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name,
xmlDtdPtr cur; xmlDtdPtr cur;
if ((doc != NULL) && (xmlGetIntSubset(doc) != NULL)) { 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); return(NULL);
} }
@ -1187,10 +1160,6 @@ xmlFreeDoc(xmlDocPtr cur) {
xmlDictPtr dict = NULL; xmlDictPtr dict = NULL;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlFreeDoc : document == NULL\n");
#endif
return; return;
} }
@ -1882,10 +1851,6 @@ xmlAttrPtr
xmlNewProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) { xmlNewProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) {
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNewProp : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -1908,10 +1873,6 @@ xmlNewNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name,
const xmlChar *value) { const xmlChar *value) {
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNewNsProp : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -1933,10 +1894,6 @@ xmlNewNsPropEatName(xmlNodePtr node, xmlNsPtr ns, xmlChar *name,
const xmlChar *value) { const xmlChar *value) {
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNewNsPropEatName : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -1957,10 +1914,6 @@ xmlNewDocProp(xmlDocPtr doc, const xmlChar *name, const xmlChar *value) {
xmlAttrPtr cur; xmlAttrPtr cur;
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNewDocProp : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -2055,17 +2008,9 @@ int
xmlRemoveProp(xmlAttrPtr cur) { xmlRemoveProp(xmlAttrPtr cur) {
xmlAttrPtr tmp; xmlAttrPtr tmp;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlRemoveProp : cur == NULL\n");
#endif
return(-1); return(-1);
} }
if (cur->parent == NULL) { if (cur->parent == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlRemoveProp : cur->parent == NULL\n");
#endif
return(-1); return(-1);
} }
tmp = cur->parent->properties; tmp = cur->parent->properties;
@ -2086,10 +2031,6 @@ xmlRemoveProp(xmlAttrPtr cur) {
} }
tmp = tmp->next; tmp = tmp->next;
} }
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlRemoveProp : attribute not owned by its node\n");
#endif
return(-1); return(-1);
} }
@ -2107,10 +2048,6 @@ xmlNewDocPI(xmlDocPtr doc, const xmlChar *name, const xmlChar *content) {
xmlNodePtr cur; xmlNodePtr cur;
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNewPI : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -2169,10 +2106,6 @@ xmlNewNode(xmlNsPtr ns, const xmlChar *name) {
xmlNodePtr cur; xmlNodePtr cur;
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNewNode : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -2211,10 +2144,6 @@ xmlNewNodeEatName(xmlNsPtr ns, xmlChar *name) {
xmlNodePtr cur; xmlNodePtr cur;
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNewNode : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -2429,18 +2358,10 @@ xmlNewTextChild(xmlNodePtr parent, xmlNsPtr ns,
xmlNodePtr cur, prev; xmlNodePtr cur, prev;
if (parent == NULL) { if (parent == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNewTextChild : parent == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNewTextChild : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -2809,18 +2730,10 @@ xmlNewChild(xmlNodePtr parent, xmlNsPtr ns,
xmlNodePtr cur, prev; xmlNodePtr cur, prev;
if (parent == NULL) { if (parent == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNewChild : parent == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (name == NULL) { if (name == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNewChild : name == NULL\n");
#endif
return(NULL); return(NULL);
} }
@ -2931,25 +2844,13 @@ xmlAddPropSibling(xmlNodePtr prev, xmlNodePtr cur, xmlNodePtr prop) {
xmlNodePtr xmlNodePtr
xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) { xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddNextSibling : cur == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (elem == NULL) { if (elem == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddNextSibling : elem == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (cur == elem) { if (cur == elem) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddNextSibling : cur == elem\n");
#endif
return(NULL); return(NULL);
} }
@ -3008,25 +2909,13 @@ xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) {
xmlNodePtr xmlNodePtr
xmlAddPrevSibling(xmlNodePtr cur, xmlNodePtr elem) { xmlAddPrevSibling(xmlNodePtr cur, xmlNodePtr elem) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddPrevSibling : cur == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (elem == NULL) { if (elem == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddPrevSibling : elem == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (cur == elem) { if (cur == elem) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddPrevSibling : cur == elem\n");
#endif
return(NULL); return(NULL);
} }
@ -3086,26 +2975,14 @@ xmlAddSibling(xmlNodePtr cur, xmlNodePtr elem) {
xmlNodePtr parent; xmlNodePtr parent;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddSibling : cur == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (elem == NULL) { if (elem == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddSibling : elem == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (cur == elem) { if (cur == elem) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddSibling : cur == elem\n");
#endif
return(NULL); return(NULL);
} }
@ -3162,27 +3039,15 @@ xmlAddChildList(xmlNodePtr parent, xmlNodePtr cur) {
xmlNodePtr prev; xmlNodePtr prev;
if (parent == NULL) { if (parent == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddChildList : parent == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddChildList : child == NULL\n");
#endif
return(NULL); return(NULL);
} }
if ((cur->doc != NULL) && (parent->doc != NULL) && if ((cur->doc != NULL) && (parent->doc != NULL) &&
(cur->doc != parent->doc)) { (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; xmlNodePtr prev;
if (parent == NULL) { if (parent == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddChild : parent == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddChild : child == NULL\n");
#endif
return(NULL); return(NULL);
} }
if (parent == cur) { if (parent == cur) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddChild : parent == cur\n");
#endif
return(NULL); return(NULL);
} }
/* /*
@ -3370,10 +3223,6 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) {
xmlNodePtr xmlNodePtr
xmlGetLastChild(xmlNodePtr parent) { xmlGetLastChild(xmlNodePtr parent) {
if (parent == NULL) { if (parent == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlGetLastChild : parent == NULL\n");
#endif
return(NULL); return(NULL);
} }
return(parent->last); return(parent->last);
@ -3722,10 +3571,6 @@ xmlFreeNode(xmlNodePtr cur) {
void void
xmlUnlinkNode(xmlNodePtr cur) { xmlUnlinkNode(xmlNodePtr cur) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlUnlinkNode : node == NULL\n");
#endif
return; return;
} }
if (cur->type == XML_DTD_NODE) { if (cur->type == XML_DTD_NODE) {
@ -3797,10 +3642,6 @@ xmlNodePtr
xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) { xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) {
if (old == cur) return(NULL); if (old == cur) return(NULL);
if ((old == NULL) || (old->parent == NULL)) { if ((old == NULL) || (old->parent == NULL)) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlReplaceNode : old == NULL or without parent\n");
#endif
return(NULL); return(NULL);
} }
if (cur == NULL) { if (cur == NULL) {
@ -3811,17 +3652,9 @@ xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) {
return(old); return(old);
} }
if ((old->type==XML_ATTRIBUTE_NODE) && (cur->type!=XML_ATTRIBUTE_NODE)) { 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); return(old);
} }
if ((cur->type==XML_ATTRIBUTE_NODE) && (old->type!=XML_ATTRIBUTE_NODE)) { 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); return(old);
} }
xmlUnlinkNode(cur); xmlUnlinkNode(cur);
@ -3874,10 +3707,6 @@ xmlCopyNamespace(xmlNsPtr cur) {
ret = xmlNewNs(NULL, cur->href, cur->prefix); ret = xmlNewNs(NULL, cur->href, cur->prefix);
break; break;
default: default:
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlCopyNamespace: invalid type %d\n", cur->type);
#endif
return(NULL); return(NULL);
} }
return(ret); return(ret);
@ -5439,10 +5268,6 @@ xmlNodeGetContent(xmlNodePtr cur)
void void
xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) { xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNodeSetContent : node == NULL\n");
#endif
return; return;
} }
switch (cur->type) { switch (cur->type) {
@ -5513,10 +5338,6 @@ xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) {
void void
xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) { xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNodeSetContentLen : node == NULL\n");
#endif
return; return;
} }
switch (cur->type) { switch (cur->type) {
@ -5584,10 +5405,6 @@ xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
void void
xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) { xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNodeAddContentLen : node == NULL\n");
#endif
return; return;
} }
if (len <= 0) return; if (len <= 0) return;
@ -5658,10 +5475,6 @@ xmlNodeAddContent(xmlNodePtr cur, const xmlChar *content) {
int len; int len;
if (cur == NULL) { if (cur == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNodeAddContent : node == NULL\n");
#endif
return; return;
} }
if (content == NULL) return; if (content == NULL) return;
@ -6031,17 +5844,9 @@ xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
int counter = 1; int counter = 1;
if (tree == NULL) { if (tree == NULL) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNewReconciliedNs : tree == NULL\n");
#endif
return(NULL); return(NULL);
} }
if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) { if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlNewReconciliedNs : ns == NULL\n");
#endif
return(NULL); return(NULL);
} }
/* /*
@ -6781,10 +6586,6 @@ xmlTextConcat(xmlNodePtr node, const xmlChar *content, int len) {
(node->type != XML_CDATA_SECTION_NODE) && (node->type != XML_CDATA_SECTION_NODE) &&
(node->type != XML_COMMENT_NODE) && (node->type != XML_COMMENT_NODE) &&
(node->type != XML_PI_NODE)) { (node->type != XML_PI_NODE)) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlTextConcat: node is not text nor CDATA\n");
#endif
return(-1); return(-1);
} }
/* need to check if content is currently in the dictionary */ /* need to check if content is currently in the dictionary */
@ -6910,10 +6711,6 @@ void
xmlBufferSetAllocationScheme(xmlBufferPtr buf, xmlBufferSetAllocationScheme(xmlBufferPtr buf,
xmlBufferAllocationScheme scheme) { xmlBufferAllocationScheme scheme) {
if (buf == NULL) { if (buf == NULL) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
"xmlBufferSetAllocationScheme: buf == NULL\n");
#endif
return; return;
} }
if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) || if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) ||
@ -6934,10 +6731,6 @@ xmlBufferSetAllocationScheme(xmlBufferPtr buf,
void void
xmlBufferFree(xmlBufferPtr buf) { xmlBufferFree(xmlBufferPtr buf) {
if (buf == NULL) { if (buf == NULL) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
"xmlBufferFree: buf == NULL\n");
#endif
return; return;
} }
@ -7090,17 +6883,9 @@ xmlBufferDump(FILE *file, xmlBufferPtr buf) {
int ret; int ret;
if (buf == NULL) { if (buf == NULL) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
"xmlBufferDump: buf == NULL\n");
#endif
return(0); return(0);
} }
if (buf->content == NULL) { if (buf->content == NULL) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
"xmlBufferDump: buf->content == NULL\n");
#endif
return(0); return(0);
} }
if (file == NULL) 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 (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
if (len < -1) { if (len < -1) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
"xmlBufferAdd: len < 0\n");
#endif
return -1; return -1;
} }
if (len == 0) return 0; if (len == 0) return 0;
@ -7308,17 +7089,9 @@ xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) {
return(-1); return(-1);
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1; if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
if (str == NULL) { if (str == NULL) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
"xmlBufferAddHead: str == NULL\n");
#endif
return -1; return -1;
} }
if (len < -1) { if (len < -1) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
"xmlBufferAddHead: len < 0\n");
#endif
return -1; return -1;
} }
if (len == 0) return 0; if (len == 0) return 0;
@ -7394,10 +7167,6 @@ xmlBufferCCat(xmlBufferPtr buf, const char *str) {
return(-1); return(-1);
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1; if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
if (str == NULL) { if (str == NULL) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
"xmlBufferCCat: str == NULL\n");
#endif
return -1; return -1;
} }
for (cur = str;*cur != 0;cur++) { 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 (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return;
if (xmlStrchr(string, '\"')) { if (xmlStrchr(string, '\"')) {
if (xmlStrchr(string, '\'')) { if (xmlStrchr(string, '\'')) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
"xmlBufferWriteQuotedString: string contains quote and double-quotes !\n");
#endif
xmlBufferCCat(buf, "\""); xmlBufferCCat(buf, "\"");
base = cur = string; base = cur = string;
while(*cur != 0){ while(*cur != 0){

View File

@ -28,9 +28,6 @@
static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name,
int create); int create);
/* #define DEBUG_VALID_ALGO */
/* #define DEBUG_REGEXP_ALGO */
#define TODO \ #define TODO \
xmlGenericError(xmlGenericErrorContext, \ xmlGenericError(xmlGenericErrorContext, \
"Unimplemented block at %s:%d\n", \ "Unimplemented block at %s:%d\n", \

View File

@ -92,15 +92,7 @@
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/globals.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 #define MINLEN 4000
#endif
/* /*
* Input I/O callback sets * Input I/O callback sets
@ -1644,11 +1636,6 @@ xmlParserInputBufferPush(xmlParserInputBufferPtr in,
if (ret != 0) if (ret != 0)
return(-1); 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); return(nbchars);
} }
@ -1754,11 +1741,6 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
in->buffer->use += nbchars; in->buffer->use += nbchars;
buffer[nbchars] = 0; 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); return(nbchars);
} }
@ -1900,10 +1882,6 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID,
xmlParserInputPtr ret = NULL; xmlParserInputPtr ret = NULL;
xmlChar *resource = NULL; xmlChar *resource = NULL;
#ifdef DEBUG_EXTERNAL_ENTITIES
xmlGenericError(xmlGenericErrorContext,
"xmlDefaultExternalEntityLoader(%s, xxx)\n", URL);
#endif
if ((ctxt != NULL) && (ctxt->options & XML_PARSE_NONET)) { if ((ctxt != NULL) && (ctxt->options & XML_PARSE_NONET)) {
int options = ctxt->options; int options = ctxt->options;

View File

@ -29,20 +29,6 @@
#include <ctype.h> #include <ctype.h>
#endif #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/globals.h> /* must come before xmlmemory.h */
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
@ -89,10 +75,6 @@ typedef struct memnod {
unsigned int mh_type; unsigned int mh_type;
unsigned long mh_number; unsigned long mh_number;
size_t mh_size; size_t mh_size;
#ifdef MEM_LIST
struct memnod *mh_next;
struct memnod *mh_prev;
#endif
const char *mh_file; const char *mh_file;
unsigned int mh_line; unsigned int mh_line;
} MEMHDR; } MEMHDR;
@ -115,15 +97,8 @@ typedef struct memnod {
static unsigned int block=0; static unsigned int block=0;
static unsigned int xmlMemStopAtBlock = 0; static unsigned int xmlMemStopAtBlock = 0;
static void *xmlMemTraceBlockAt = NULL; static void *xmlMemTraceBlockAt = NULL;
#ifdef MEM_LIST
static MEMHDR *memlist = NULL;
#endif
static void debugmem_tag_error(void *addr); 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); #define Mem_Tag_Err(a) debugmem_tag_error(a);
#ifndef TEST_POINT #ifndef TEST_POINT
@ -162,10 +137,6 @@ xmlMallocLoc(size_t size, const char * file, int line)
void *ret; void *ret;
if (!xmlMemInitialized) xmlInitMemory(); if (!xmlMemInitialized) xmlInitMemory();
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"Malloc(%d)\n",size);
#endif
TEST_POINT TEST_POINT
@ -187,15 +158,8 @@ xmlMallocLoc(size_t size, const char * file, int line)
debugMemSize += size; debugMemSize += size;
debugMemBlocks++; debugMemBlocks++;
if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
#ifdef MEM_LIST
debugmem_list_add(p);
#endif
xmlMutexUnlock(xmlMemMutex); xmlMutexUnlock(xmlMemMutex);
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"Malloc(%d) Ok\n",size);
#endif
if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint(); if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
@ -231,10 +195,6 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line)
void *ret; void *ret;
if (!xmlMemInitialized) xmlInitMemory(); if (!xmlMemInitialized) xmlInitMemory();
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"Malloc(%d)\n",size);
#endif
TEST_POINT TEST_POINT
@ -256,15 +216,8 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line)
debugMemSize += size; debugMemSize += size;
debugMemBlocks++; debugMemBlocks++;
if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
#ifdef MEM_LIST
debugmem_list_add(p);
#endif
xmlMutexUnlock(xmlMemMutex); xmlMutexUnlock(xmlMemMutex);
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"Malloc(%d) Ok\n",size);
#endif
if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint(); if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
@ -313,9 +266,6 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
{ {
MEMHDR *p; MEMHDR *p;
unsigned long number; unsigned long number;
#ifdef DEBUG_MEMORY
size_t oldsize;
#endif
if (ptr == NULL) if (ptr == NULL)
return(xmlMallocLoc(size, file, line)); return(xmlMallocLoc(size, file, line));
@ -334,12 +284,6 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
xmlMutexLock(xmlMemMutex); xmlMutexLock(xmlMemMutex);
debugMemSize -= p->mh_size; debugMemSize -= p->mh_size;
debugMemBlocks--; debugMemBlocks--;
#ifdef DEBUG_MEMORY
oldsize = p->mh_size;
#endif
#ifdef MEM_LIST
debugmem_list_delete(p);
#endif
xmlMutexUnlock(xmlMemMutex); xmlMutexUnlock(xmlMemMutex);
p = (MEMHDR *) realloc(p,RESERVE_SIZE+size); p = (MEMHDR *) realloc(p,RESERVE_SIZE+size);
@ -363,17 +307,10 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
debugMemSize += size; debugMemSize += size;
debugMemBlocks++; debugMemBlocks++;
if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
#ifdef MEM_LIST
debugmem_list_add(p);
#endif
xmlMutexUnlock(xmlMemMutex); xmlMutexUnlock(xmlMemMutex);
TEST_POINT TEST_POINT
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"Realloced(%d to %d) Ok\n", oldsize, size);
#endif
return(HDR_2_CLIENT(p)); return(HDR_2_CLIENT(p));
error: error:
@ -406,9 +343,6 @@ xmlMemFree(void *ptr)
{ {
MEMHDR *p; MEMHDR *p;
char *target; char *target;
#ifdef DEBUG_MEMORY
size_t size;
#endif
if (ptr == NULL) if (ptr == NULL)
return; return;
@ -440,22 +374,12 @@ xmlMemFree(void *ptr)
xmlMutexLock(xmlMemMutex); xmlMutexLock(xmlMemMutex);
debugMemSize -= p->mh_size; debugMemSize -= p->mh_size;
debugMemBlocks--; debugMemBlocks--;
#ifdef DEBUG_MEMORY
size = p->mh_size;
#endif
#ifdef MEM_LIST
debugmem_list_delete(p);
#endif
xmlMutexUnlock(xmlMemMutex); xmlMutexUnlock(xmlMemMutex);
free(p); free(p);
TEST_POINT TEST_POINT
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"Freed(%d) Ok\n", size);
#endif
return; return;
@ -501,9 +425,6 @@ xmlMemStrdupLoc(const char *str, const char *file, int line)
debugMemSize += size; debugMemSize += size;
debugMemBlocks++; debugMemBlocks++;
if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
#ifdef MEM_LIST
debugmem_list_add(p);
#endif
xmlMutexUnlock(xmlMemMutex); xmlMutexUnlock(xmlMemMutex);
s = (char *) HDR_2_CLIENT(p); s = (char *) HDR_2_CLIENT(p);
@ -569,66 +490,6 @@ xmlMemBlocks(void) {
return(debugMemBlocks); 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: * xmlMemDisplayLast:
* @fp: a FILE descriptor used as the output file, if NULL, the result is * @fp: a FILE descriptor used as the output file, if NULL, the result is
@ -642,11 +503,6 @@ xmlMemContentShow(FILE *fp, MEMHDR *p)
void void
xmlMemDisplayLast(FILE *fp, long nbBytes) xmlMemDisplayLast(FILE *fp, long nbBytes)
{ {
#ifdef MEM_LIST
MEMHDR *p;
unsigned idx;
int nb = 0;
#endif
FILE *old_fp = fp; FILE *old_fp = fp;
if (nbBytes <= 0) if (nbBytes <= 0)
@ -658,46 +514,7 @@ xmlMemDisplayLast(FILE *fp, long nbBytes)
return; 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"); fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
#endif
if (old_fp == NULL) if (old_fp == NULL)
fclose(fp); fclose(fp);
} }
@ -713,16 +530,6 @@ xmlMemDisplayLast(FILE *fp, long nbBytes)
void void
xmlMemDisplay(FILE *fp) 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; FILE *old_fp = fp;
if (fp == NULL) { if (fp == NULL) {
@ -731,86 +538,11 @@ xmlMemDisplay(FILE *fp)
return; return;
} }
#ifdef MEM_LIST
#if defined(HAVE_LOCALTIME) && defined(HAVE_STRFTIME)
currentTime = time(NULL);
tstruct = localtime(&currentTime);
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"); fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
#endif
if (old_fp == NULL) if (old_fp == NULL)
fclose(fp); 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: * debugmem_tag_error:
* *
@ -821,15 +553,8 @@ static void debugmem_tag_error(void *p)
{ {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"Memory tag error occurs :%p \n\t bye\n", p); "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: * xmlMemShow:
@ -843,40 +568,10 @@ static FILE *xmlMemoryDumpFile = NULL;
void void
xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED) xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED)
{ {
#ifdef MEM_LIST
MEMHDR *p;
#endif
if (fp != NULL) if (fp != NULL)
fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n", fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n",
debugMemSize, debugMaxMemSize); 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 void
xmlMemoryDump(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 #ifdef HAVE_STDLIB_H
char *breakpoint; char *breakpoint;
#endif
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"xmlInitMemory()\n");
#endif #endif
/* /*
This is really not good code (see Bug 130419). Suggestions for This is really not good code (see Bug 130419). Suggestions for
@ -949,10 +626,6 @@ xmlInitMemory(void)
} }
#endif #endif
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"xmlInitMemory() Ok\n");
#endif
return(0); return(0);
} }
@ -964,20 +637,12 @@ xmlInitMemory(void)
*/ */
void void
xmlCleanupMemory(void) { xmlCleanupMemory(void) {
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"xmlCleanupMemory()\n");
#endif
if (xmlMemInitialized == 0) if (xmlMemInitialized == 0)
return; return;
xmlFreeMutex(xmlMemMutex); xmlFreeMutex(xmlMemMutex);
xmlMemMutex = NULL; xmlMemMutex = NULL;
xmlMemInitialized = 0; xmlMemInitialized = 0;
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"xmlCleanupMemory() Ok\n");
#endif
} }
/** /**
@ -998,10 +663,6 @@ xmlCleanupMemory(void) {
int int
xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc) { xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc) {
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"xmlMemSetup()\n");
#endif
if (freeFunc == NULL) if (freeFunc == NULL)
return(-1); return(-1);
if (mallocFunc == NULL) if (mallocFunc == NULL)
@ -1015,10 +676,6 @@ xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
xmlMallocAtomic = mallocFunc; xmlMallocAtomic = mallocFunc;
xmlRealloc = reallocFunc; xmlRealloc = reallocFunc;
xmlMemStrdup = strdupFunc; xmlMemStrdup = strdupFunc;
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"xmlMemSetup() Ok\n");
#endif
return(0); return(0);
} }
@ -1065,10 +722,6 @@ int
xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
xmlMallocFunc mallocAtomicFunc, xmlReallocFunc reallocFunc, xmlMallocFunc mallocAtomicFunc, xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc) { xmlStrdupFunc strdupFunc) {
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"xmlGcMemSetup()\n");
#endif
if (freeFunc == NULL) if (freeFunc == NULL)
return(-1); return(-1);
if (mallocFunc == NULL) if (mallocFunc == NULL)
@ -1084,10 +737,6 @@ xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
xmlMallocAtomic = mallocAtomicFunc; xmlMallocAtomic = mallocAtomicFunc;
xmlRealloc = reallocFunc; xmlRealloc = reallocFunc;
xmlMemStrdup = strdupFunc; xmlMemStrdup = strdupFunc;
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"xmlGcMemSetup() Ok\n");
#endif
return(0); return(0);
} }

View File

@ -55,9 +55,6 @@
#endif #endif
#endif #endif
/* #define DEBUG_CALLBACKS */
/* #define DEBUG_READER */
/** /**
* TODO: * TODO:
* *
@ -68,12 +65,6 @@
"Unimplemented block at %s:%d\n", \ "Unimplemented block at %s:%d\n", \
__FILE__, __LINE__); __FILE__, __LINE__);
#ifdef DEBUG_READER
#define DUMP_READER xmlTextReaderDebug(reader);
#else
#define DUMP_READER
#endif
#define CHUNK_SIZE 512 #define CHUNK_SIZE 512
/************************************************************************ /************************************************************************
* * * *
@ -506,29 +497,6 @@ xmlTextReaderFreeDoc(xmlTextReaderPtr reader, xmlDocPtr cur) {
* The reader core parser * * 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: * xmlTextReaderEntPush:
@ -606,9 +574,6 @@ xmlTextReaderStartElement(void *ctx, const xmlChar *fullname,
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlTextReaderPtr reader = ctxt->_private; xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS
printf("xmlTextReaderStartElement(%s)\n", fullname);
#endif
if ((reader != NULL) && (reader->startElement != NULL)) { if ((reader != NULL) && (reader->startElement != NULL)) {
reader->startElement(ctx, fullname, atts); reader->startElement(ctx, fullname, atts);
if ((ctxt->node != NULL) && (ctxt->input != NULL) && if ((ctxt->node != NULL) && (ctxt->input != NULL) &&
@ -632,9 +597,6 @@ xmlTextReaderEndElement(void *ctx, const xmlChar *fullname) {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlTextReaderPtr reader = ctxt->_private; xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS
printf("xmlTextReaderEndElement(%s)\n", fullname);
#endif
if ((reader != NULL) && (reader->endElement != NULL)) { if ((reader != NULL) && (reader->endElement != NULL)) {
reader->endElement(ctx, fullname); reader->endElement(ctx, fullname);
} }
@ -669,9 +631,6 @@ xmlTextReaderStartElementNs(void *ctx,
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlTextReaderPtr reader = ctxt->_private; xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS
printf("xmlTextReaderStartElementNs(%s)\n", localname);
#endif
if ((reader != NULL) && (reader->startElementNs != NULL)) { if ((reader != NULL) && (reader->startElementNs != NULL)) {
reader->startElementNs(ctx, localname, prefix, URI, nb_namespaces, reader->startElementNs(ctx, localname, prefix, URI, nb_namespaces,
namespaces, nb_attributes, nb_defaulted, namespaces, nb_attributes, nb_defaulted,
@ -703,9 +662,6 @@ xmlTextReaderEndElementNs(void *ctx,
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlTextReaderPtr reader = ctxt->_private; xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS
printf("xmlTextReaderEndElementNs(%s)\n", localname);
#endif
if ((reader != NULL) && (reader->endElementNs != NULL)) { if ((reader != NULL) && (reader->endElementNs != NULL)) {
reader->endElementNs(ctx, localname, prefix, URI); reader->endElementNs(ctx, localname, prefix, URI);
} }
@ -726,9 +682,6 @@ xmlTextReaderCharacters(void *ctx, const xmlChar *ch, int len)
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlTextReaderPtr reader = ctxt->_private; xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS
printf("xmlTextReaderCharacters()\n");
#endif
if ((reader != NULL) && (reader->characters != NULL)) { if ((reader != NULL) && (reader->characters != NULL)) {
reader->characters(ctx, ch, len); reader->characters(ctx, ch, len);
} }
@ -748,9 +701,6 @@ xmlTextReaderCDataBlock(void *ctx, const xmlChar *ch, int len)
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlTextReaderPtr reader = ctxt->_private; xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS
printf("xmlTextReaderCDataBlock()\n");
#endif
if ((reader != NULL) && (reader->cdataBlock != NULL)) { if ((reader != NULL) && (reader->cdataBlock != NULL)) {
reader->cdataBlock(ctx, ch, len); reader->cdataBlock(ctx, ch, len);
} }
@ -990,10 +940,6 @@ xmlTextReaderRead(xmlTextReaderPtr reader) {
if (reader->ctxt->wellFormed != 1) if (reader->ctxt->wellFormed != 1)
return(-1); return(-1);
#ifdef DEBUG_READER
fprintf(stderr, "\nREAD ");
DUMP_READER
#endif
if (reader->mode == XML_TEXTREADER_MODE_INITIAL) { if (reader->mode == XML_TEXTREADER_MODE_INITIAL) {
reader->mode = XML_TEXTREADER_MODE_INTERACTIVE; reader->mode = XML_TEXTREADER_MODE_INTERACTIVE;
/* /*
@ -1164,8 +1110,6 @@ get_next_node:
reader->state = XML_TEXTREADER_BACKTRACK; reader->state = XML_TEXTREADER_BACKTRACK;
node_found: node_found:
DUMP_READER
/* /*
* If we are in the middle of a piece of CDATA make sure it's finished * If we are in the middle of a piece of CDATA make sure it's finished
*/ */