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:
@@ -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
|
||||||
|
56
catalog.c
56
catalog.c
@@ -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,13 +2664,16 @@ xmlACatalogResolve(xmlCatalogPtr catal, const xmlChar * pubID,
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
if (xmlDebugCatalogs) {
|
if (xmlDebugCatalogs) {
|
||||||
if (pubID != NULL) {
|
if ((pubID != NULL) && (sysID != NULL)) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"Resolve: pubID %s\n", pubID);
|
"Resolve: pubID %s sysID %s\n", pubID, sysID);
|
||||||
} else {
|
} else if (pubID != NULL) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"Resolve: sysID %s\n", sysID);
|
"Resolve: pubID %s\n", pubID);
|
||||||
}
|
} else {
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"Resolve: sysID %s\n", sysID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (catal->type == XML_XML_CATALOG_TYPE) {
|
if (catal->type == XML_XML_CATALOG_TYPE) {
|
||||||
@@ -3434,13 +3437,16 @@ 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 {
|
} else if (pubID != NULL) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"Local resolve: sysID %s\n", sysID);
|
"Local Resolve: pubID %s\n", pubID);
|
||||||
}
|
} else {
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"Local Resolve: sysID %s\n", sysID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
catal = (xmlCatalogEntryPtr) catalogs;
|
catal = (xmlCatalogEntryPtr) catalogs;
|
||||||
|
5
parser.c
5
parser.c
@@ -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
15
valid.c
@@ -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);
|
||||||
|
Reference in New Issue
Block a user