1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-21 14:53:44 +03:00

fixed the main issues reported by Peter Breitenlohner cleanup speedup

* catalog.c: fixed the main issues reported by Peter Breitenlohner
* parser.c: cleanup
* valid.c: speedup patch from Petr Pajas
Daniel
This commit is contained in:
Daniel Veillard
2004-02-25 10:44:30 +00:00
parent a59ddb5ea4
commit 770075b500
4 changed files with 51 additions and 31 deletions

View File

@@ -1,3 +1,9 @@
Wed Feb 25 11:36:06 CET 2004 Daniel Veillard <daniel@veillard.com>
* catalog.c: fixed the main issues reported by Peter Breitenlohner
* parser.c: cleanup
* valid.c: speedup patch from Petr Pajas
Wed Feb 25 16:07:14 HKT 2004 William Brack <wbrack@mmm.com.hk> Wed Feb 25 16:07:14 HKT 2004 William Brack <wbrack@mmm.com.hk>
* xpath.c: fixed a memory leak (xmlXPathLangFunction) reported * xpath.c: fixed a memory leak (xmlXPathLangFunction) reported

View File

@@ -749,7 +749,7 @@ xmlCatalogUnWrapURN(const xmlChar *urn) {
urn += sizeof(XML_URN_PUBID) - 1; urn += sizeof(XML_URN_PUBID) - 1;
while (*urn != 0) { while (*urn != 0) {
if (i > sizeof(result) - 3) if (i > sizeof(result) - 4)
break; break;
if (*urn == '+') { if (*urn == '+') {
result[i++] = ' '; result[i++] = ' ';
@@ -763,21 +763,21 @@ xmlCatalogUnWrapURN(const xmlChar *urn) {
result[i++] = ':'; result[i++] = ':';
urn++; urn++;
} else if (*urn == '%') { } else if (*urn == '%') {
if ((urn[1] == '2') && (urn[1] == 'B')) if ((urn[1] == '2') && (urn[2] == 'B'))
result[i++] = '+'; result[i++] = '+';
else if ((urn[1] == '3') && (urn[1] == 'A')) else if ((urn[1] == '3') && (urn[2] == 'A'))
result[i++] = ':'; result[i++] = ':';
else if ((urn[1] == '2') && (urn[1] == 'F')) else if ((urn[1] == '2') && (urn[2] == 'F'))
result[i++] = '/'; result[i++] = '/';
else if ((urn[1] == '3') && (urn[1] == 'B')) else if ((urn[1] == '3') && (urn[2] == 'B'))
result[i++] = ';'; result[i++] = ';';
else if ((urn[1] == '2') && (urn[1] == '7')) else if ((urn[1] == '2') && (urn[2] == '7'))
result[i++] = '\''; result[i++] = '\'';
else if ((urn[1] == '3') && (urn[1] == 'F')) else if ((urn[1] == '3') && (urn[2] == 'F'))
result[i++] = '?'; result[i++] = '?';
else if ((urn[1] == '2') && (urn[1] == '3')) else if ((urn[1] == '2') && (urn[2] == '3'))
result[i++] = '#'; result[i++] = '#';
else if ((urn[1] == '2') && (urn[1] == '5')) else if ((urn[1] == '2') && (urn[2] == '5'))
result[i++] = '%'; result[i++] = '%';
else { else {
result[i++] = *urn; result[i++] = *urn;
@@ -1887,7 +1887,7 @@ xmlCatalogListXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID,
else if (xmlStrEqual(pubID, urnID)) else if (xmlStrEqual(pubID, urnID))
ret = xmlCatalogListXMLResolve(catal, pubID, NULL); ret = xmlCatalogListXMLResolve(catal, pubID, NULL);
else { else {
ret = xmlCatalogListXMLResolve(catal, pubID, NULL); ret = xmlCatalogListXMLResolve(catal, pubID, urnID);
} }
if (urnID != NULL) if (urnID != NULL)
xmlFree(urnID); xmlFree(urnID);
@@ -2383,7 +2383,7 @@ xmlCatalogGetSGMLPublic(xmlHashTablePtr catal, const xmlChar *pubID) {
* *
* Try to lookup the catalog local reference for a system ID * Try to lookup the catalog local reference for a system ID
* *
* Returns the system ID if found or NULL otherwise. * Returns the local resource if found or NULL otherwise.
*/ */
static const xmlChar * static const xmlChar *
xmlCatalogGetSGMLSystem(xmlHashTablePtr catal, const xmlChar *sysID) { xmlCatalogGetSGMLSystem(xmlHashTablePtr catal, const xmlChar *sysID) {
@@ -2664,7 +2664,10 @@ xmlACatalogResolve(xmlCatalogPtr catal, const xmlChar * pubID,
return (NULL); return (NULL);
if (xmlDebugCatalogs) { if (xmlDebugCatalogs) {
if (pubID != NULL) { if ((pubID != NULL) && (sysID != NULL)) {
xmlGenericError(xmlGenericErrorContext,
"Resolve: pubID %s sysID %s\n", pubID, sysID);
} else if (pubID != NULL) {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"Resolve: pubID %s\n", pubID); "Resolve: pubID %s\n", pubID);
} else { } else {
@@ -3434,12 +3437,15 @@ xmlCatalogLocalResolve(void *catalogs, const xmlChar *pubID,
return(NULL); return(NULL);
if (xmlDebugCatalogs) { if (xmlDebugCatalogs) {
if (pubID != NULL) { if ((pubID != NULL) && (sysID != NULL)) {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"Local resolve: pubID %s\n", pubID); "Local Resolve: pubID %s sysID %s\n", pubID, sysID);
} else if (pubID != NULL) {
xmlGenericError(xmlGenericErrorContext,
"Local Resolve: pubID %s\n", pubID);
} else { } else {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"Local resolve: sysID %s\n", sysID); "Local Resolve: sysID %s\n", sysID);
} }
} }

View File

@@ -3143,11 +3143,6 @@ get_more_space:
return; return;
} }
get_more: get_more:
#if 0
while (((*in >= 0x20) && (*in != '<') && (*in != ']') &&
(*in != '&') && (*in <= 0x7F)) || (*in == 0x09))
in++;
#endif
while (((*in > ']') && (*in <= 0x7F)) || while (((*in > ']') && (*in <= 0x7F)) ||
((*in > '&') && (*in < '<')) || ((*in > '&') && (*in < '<')) ||
((*in > '<') && (*in < ']')) || ((*in > '<') && (*in < ']')) ||

15
valid.c
View File

@@ -2714,6 +2714,19 @@ xmlWalkRemoveRef(const void *data, const void *user)
return 1; return 1;
} }
/**
* xmlDummyCompare
* @data0: Value supplied by the user
* @data1: Value supplied by the user
*
* Do nothing, return 0. Used to create unordered lists.
*/
static int
xmlDummyCompare(const void *data0, const void *data1)
{
return (0);
}
/** /**
* xmlAddRef: * xmlAddRef:
* @ctxt: the validation context * @ctxt: the validation context
@@ -2784,7 +2797,7 @@ xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
*/ */
if (NULL == (ref_list = xmlHashLookup(table, value))) { if (NULL == (ref_list = xmlHashLookup(table, value))) {
if (NULL == (ref_list = xmlListCreate(xmlFreeRef, NULL))) { if (NULL == (ref_list = xmlListCreate(xmlFreeRef, xmlDummyCompare))) {
xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
"xmlAddRef: Reference list creation failed!\n", "xmlAddRef: Reference list creation failed!\n",
NULL); NULL);