Upgrade libxml to 2.9.1

Bug: 7246045

Change-Id: I8d0abc6b9e3f691f6e282a8912d1af7b24b21aa5
diff --git a/hash.c b/hash.c
index fe1424f..0145109 100644
--- a/hash.c
+++ b/hash.c
@@ -47,10 +47,6 @@
 
 /* #define DEBUG_GROW */
 
-#ifdef HASH_RANDOMIZATION
-static int hash_initialized = 0;
-#endif
-
 /*
  * A single entry in the hash table
  */
@@ -87,7 +83,7 @@
 	          const xmlChar *name2, const xmlChar *name3) {
     unsigned long value = 0L;
     char ch;
-    
+
 #ifdef HASH_RANDOMIZATION
     value = table->random_seed;
 #endif
@@ -97,11 +93,13 @@
 	    value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
 	}
     }
+    value = value ^ ((value << 5) + (value >> 3));
     if (name2 != NULL) {
 	while ((ch = *name2++) != 0) {
 	    value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
 	}
     }
+    value = value ^ ((value << 5) + (value >> 3));
     if (name3 != NULL) {
 	while ((ch = *name3++) != 0) {
 	    value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
@@ -117,7 +115,7 @@
 		   const xmlChar *prefix3, const xmlChar *name3) {
     unsigned long value = 0L;
     char ch;
-    
+
 #ifdef HASH_RANDOMIZATION
     value = table->random_seed;
 #endif
@@ -137,6 +135,7 @@
 	    value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
 	}
     }
+    value = value ^ ((value << 5) + (value >> 3));
     if (prefix2 != NULL) {
 	while ((ch = *prefix2++) != 0) {
 	    value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
@@ -148,6 +147,7 @@
 	    value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
 	}
     }
+    value = value ^ ((value << 5) + (value >> 3));
     if (prefix3 != NULL) {
 	while ((ch = *prefix3++) != 0) {
 	    value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
@@ -173,10 +173,10 @@
 xmlHashTablePtr
 xmlHashCreate(int size) {
     xmlHashTablePtr table;
-  
+
     if (size <= 0)
         size = 256;
-  
+
     table = xmlMalloc(sizeof(xmlHashTable));
     if (table) {
         table->dict = NULL;
@@ -184,15 +184,11 @@
 	table->nbElems = 0;
         table->table = xmlMalloc(size * sizeof(xmlHashEntry));
         if (table->table) {
-  	    memset(table->table, 0, size * sizeof(xmlHashEntry));
+	    memset(table->table, 0, size * sizeof(xmlHashEntry));
 #ifdef HASH_RANDOMIZATION
-            if (!hash_initialized) {
-                srand(time(NULL));
-                hash_initialized = 1;
-            }
-            table->random_seed = rand();
+            table->random_seed = __xmlRandom();
 #endif
-  	    return(table);
+	    return(table);
         }
         xmlFree(table);
     }
@@ -238,7 +234,7 @@
 #ifdef DEBUG_GROW
     unsigned long nbElem = 0;
 #endif
-  
+
     if (table == NULL)
 	return(-1);
     if (size < 8)
@@ -250,7 +246,7 @@
     oldtable = table->table;
     if (oldtable == NULL)
         return(-1);
-  
+
     table->table = xmlMalloc(size * sizeof(xmlHashEntry));
     if (table->table == NULL) {
 	table->table = oldtable;
@@ -260,13 +256,13 @@
     table->size = size;
 
     /*	If the two loops are merged, there would be situations where
-	a new entry needs to allocated and data copied into it from 
+	a new entry needs to allocated and data copied into it from
 	the main table. So instead, we run through the array twice, first
 	copying all the elements in the main array (where we can't get
 	conflicts) and then the rest, so we only free (and don't allocate)
     */
     for (i = 0; i < oldsize; i++) {
-	if (oldtable[i].valid == 0) 
+	if (oldtable[i].valid == 0)
 	    continue;
 	key = xmlHashComputeKey(table, oldtable[i].name, oldtable[i].name2,
 				oldtable[i].name3);
@@ -290,8 +286,8 @@
 		table->table[key].next = NULL;
 		xmlFree(iter);
 	    } else {
-	    	iter->next = table->table[key].next;
-	    	table->table[key].next = iter;
+		iter->next = table->table[key].next;
+		table->table[key].next = iter;
 	    }
 
 #ifdef DEBUG_GROW
@@ -607,7 +603,7 @@
     entry->valid = 1;
 
 
-    if (insert != NULL) 
+    if (insert != NULL)
 	insert->next = entry;
 
     table->nbElems++;
@@ -756,7 +752,7 @@
  * Returns the a pointer to the userdata
  */
 void *
-xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, 
+xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name,
 	       const xmlChar *name2, const xmlChar *name3) {
     unsigned long key;
     xmlHashEntryPtr entry;
@@ -829,14 +825,14 @@
     void *data;
 } stubData;
 
-static void 
-stubHashScannerFull (void *payload, void *data, const xmlChar *name, 
+static void
+stubHashScannerFull (void *payload, void *data, const xmlChar *name,
                      const xmlChar *name2 ATTRIBUTE_UNUSED,
 		     const xmlChar *name3 ATTRIBUTE_UNUSED) {
     stubData *stubdata = (stubData *) data;
     stubdata->hashscanner (payload, stubdata->data, (xmlChar *) name);
-}                                  
- 
+}
+
 /**
  * xmlHashScan:
  * @table: the hash table
@@ -849,7 +845,7 @@
 xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) {
     stubData stubdata;
     stubdata.data = data;
-    stubdata.hashscanner = f; 
+    stubdata.hashscanner = f;
     xmlHashScanFull (table, stubHashScannerFull, &stubdata);
 }
 
@@ -874,7 +870,7 @@
 
     if (table->table) {
 	for(i = 0; i < table->size; i++) {
-	    if (table->table[i].valid == 0) 
+	    if (table->table[i].valid == 0)
 		continue;
 	    iter = &(table->table[i]);
 	    while (iter) {
@@ -913,7 +909,7 @@
  * the comparison is considered to match.
  */
 void
-xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, 
+xmlHashScan3(xmlHashTablePtr table, const xmlChar *name,
 	     const xmlChar *name2, const xmlChar *name3,
 	     xmlHashScanner f, void *data) {
     xmlHashScanFull3 (table, name, name2, name3,
@@ -934,7 +930,7 @@
  * the comparison is considered to match.
  */
 void
-xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, 
+xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name,
 		 const xmlChar *name2, const xmlChar *name3,
 		 xmlHashScannerFull f, void *data) {
     int i;