1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-20 03:52:25 +03:00

change suggested by Anthony Carrico when unregistering a namespace prefix

* xpath.c: change suggested by Anthony Carrico when unregistering
  a namespace prefix to a context
* hash.c: be more careful about calling callbacks with NULL payloads.
Daniel
This commit is contained in:
Daniel Veillard
2003-10-29 11:18:37 +00:00
parent ceffd45199
commit e991fe958f
4 changed files with 15 additions and 5 deletions

View File

@@ -1,3 +1,9 @@
Wed Oct 29 12:16:52 CET 2003 Daniel Veillard <daniel@veillard.com>
* xpath.c: change suggested by Anthony Carrico when unregistering
a namespace prefix to a context
* hash.c: be more careful about calling callbacks with NULL payloads.
Wed Oct 29 00:04:26 CET 2003 Daniel Veillard <daniel@veillard.com>
* configure.in NEWS doc/*: preparing release 2.6.1, updated and

2
NEWS
View File

@@ -23,7 +23,7 @@ to test those - More testing on RelaxNG
Zlatkovic)
- xmlWriter bugfix (Alfred Mickautsch)
- chvalid.[ch]: couple of fixes from Stephane Bidoul
- context reset: error state reset, push parser reset (Graham Benett)
- context reset: error state reset, push parser reset (Graham Bennett)
- context reuse: generate errors if file is not readable
- defaulted attributes for element coming from internal entities
(Stephane Bidoul)

9
hash.c
View File

@@ -280,7 +280,7 @@ xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) {
inside_table = 1;
while (iter) {
next = iter->next;
if (f)
if ((f != NULL) && (iter->payload != NULL))
f(iter->payload, iter->name);
if (iter->name)
xmlFree(iter->name);
@@ -718,7 +718,7 @@ xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) {
iter = &(table->table[i]);
while (iter) {
next = iter->next;
if (f)
if ((f != NULL) && (iter->payload != NULL))
f(iter->payload, data, iter->name,
iter->name2, iter->name3);
iter = next;
@@ -783,7 +783,8 @@ xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name,
next = iter->next;
if (((name == NULL) || (xmlStrEqual(name, iter->name))) &&
((name2 == NULL) || (xmlStrEqual(name2, iter->name2))) &&
((name3 == NULL) || (xmlStrEqual(name3, iter->name3)))) {
((name3 == NULL) || (xmlStrEqual(name3, iter->name3))) &&
(iter->payload != NULL)) {
f(iter->payload, data, iter->name,
iter->name2, iter->name3);
}
@@ -916,7 +917,7 @@ xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
if (xmlStrEqual(entry->name, name) &&
xmlStrEqual(entry->name2, name2) &&
xmlStrEqual(entry->name3, name3)) {
if(f)
if ((f != NULL) && (entry->payload != NULL))
f(entry->payload, entry->name);
entry->payload = NULL;
if(entry->name)

View File

@@ -2974,6 +2974,9 @@ xmlXPathRegisterNs(xmlXPathContextPtr ctxt, const xmlChar *prefix,
ctxt->nsHash = xmlHashCreate(10);
if (ctxt->nsHash == NULL)
return(-1);
if (ns_uri == NULL)
return(xmlHashRemoveEntry(ctxt->nsHash, ns_uri,
(xmlHashDeallocator)xmlFree));
return(xmlHashUpdateEntry(ctxt->nsHash, prefix, (void *) xmlStrdup(ns_uri),
(xmlHashDeallocator)xmlFree));
}