optimization when freeing hash tables. some tuning of buffer allocations

* dict.c hash.c: optimization when freeing hash tables.
* parser.c xmlIO.c include/libxml/tree.h: some tuning of buffer
  allocations
* parser.c parserInternals.c include/libxml/parser.h: keep a
  single allocated block for all the attributes callbacks,
  avoid useless malloc()/free()
* tree.c: do not realloc() when growing a buffer if the buffer
  ain't full, malloc/memcpy/free avoid copying memory.
Daniel
diff --git a/hash.c b/hash.c
index 2a4d000..b4b8656 100644
--- a/hash.c
+++ b/hash.c
@@ -218,11 +218,13 @@
     xmlHashEntryPtr iter;
     xmlHashEntryPtr next;
     int inside_table = 0;
+    int nbElems;
 
     if (table == NULL)
 	return;
     if (table->table) {
-	for(i = 0; i < table->size; i++) {
+	nbElems = table->nbElems;
+	for(i = 0; (i < table->size) && (nbElems > 0); i++) {
 	    iter = &(table->table[i]);
 	    if (iter->valid == 0)
 		continue;
@@ -240,6 +242,7 @@
 		iter->payload = NULL;
 		if (!inside_table)
 		    xmlFree(iter);
+		nbElems--;
 		inside_table = 0;
 		iter = next;
 	    }