handle a erroneous parsing of attributes in case said attribute has been
* parser.c: handle a erroneous parsing of attributes in
case said attribute has been redeclared in the DTD with a
different type
* hash.c: fix the hash scanner to not crash if a first element
from the hash list is been removed in the callback
Daniel
svn path=/trunk/; revision=3669
diff --git a/hash.c b/hash.c
index e92a5a0..22f9bb4 100644
--- a/hash.c
+++ b/hash.c
@@ -828,7 +828,7 @@
*/
void
xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) {
- int i;
+ int i, nb;
xmlHashEntryPtr iter;
xmlHashEntryPtr next;
@@ -844,10 +844,21 @@
iter = &(table->table[i]);
while (iter) {
next = iter->next;
+ nb = table->nbElems;
if ((f != NULL) && (iter->payload != NULL))
f(iter->payload, data, iter->name,
iter->name2, iter->name3);
- iter = next;
+ if (nb != table->nbElems) {
+ /* table was modified by the callback, be careful */
+ if (iter == &(table->table[i])) {
+ if (table->table[i].valid == 0)
+ iter = NULL;
+ if (table->table[i].next != next)
+ iter = &(table->table[i]);
+ } else
+ iter = next;
+ } else
+ iter = next;
}
}
}