Lines Matching refs:table
79 struct _xmlHashEntry *table; member
93 xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, in xmlHashComputeKey() argument
99 value = table->random_seed; in xmlHashComputeKey()
119 return (value % table->size); in xmlHashComputeKey()
123 xmlHashComputeQKey(xmlHashTablePtr table, in xmlHashComputeQKey() argument
131 value = table->random_seed; in xmlHashComputeQKey()
173 return (value % table->size); in xmlHashComputeQKey()
186 xmlHashTablePtr table; in xmlHashCreate() local
191 table = xmlMalloc(sizeof(xmlHashTable)); in xmlHashCreate()
192 if (table) { in xmlHashCreate()
193 table->dict = NULL; in xmlHashCreate()
194 table->size = size; in xmlHashCreate()
195 table->nbElems = 0; in xmlHashCreate()
196 table->table = xmlMalloc(size * sizeof(xmlHashEntry)); in xmlHashCreate()
197 if (table->table) { in xmlHashCreate()
198 memset(table->table, 0, size * sizeof(xmlHashEntry)); in xmlHashCreate()
200 table->random_seed = __xmlRandom(); in xmlHashCreate()
202 return(table); in xmlHashCreate()
204 xmlFree(table); in xmlHashCreate()
220 xmlHashTablePtr table; in xmlHashCreateDict() local
222 table = xmlHashCreate(size); in xmlHashCreateDict()
223 if (table != NULL) { in xmlHashCreateDict()
224 table->dict = dict; in xmlHashCreateDict()
227 return(table); in xmlHashCreateDict()
240 xmlHashGrow(xmlHashTablePtr table, int size) { in xmlHashGrow() argument
249 if (table == NULL) in xmlHashGrow()
256 oldsize = table->size; in xmlHashGrow()
257 oldtable = table->table; in xmlHashGrow()
261 table->table = xmlMalloc(size * sizeof(xmlHashEntry)); in xmlHashGrow()
262 if (table->table == NULL) { in xmlHashGrow()
263 table->table = oldtable; in xmlHashGrow()
266 memset(table->table, 0, size * sizeof(xmlHashEntry)); in xmlHashGrow()
267 table->size = size; in xmlHashGrow()
278 key = xmlHashComputeKey(table, oldtable[i].name, oldtable[i].name2, in xmlHashGrow()
280 memcpy(&(table->table[key]), &(oldtable[i]), sizeof(xmlHashEntry)); in xmlHashGrow()
281 table->table[key].next = NULL; in xmlHashGrow()
293 key = xmlHashComputeKey(table, iter->name, iter->name2, in xmlHashGrow()
295 if (table->table[key].valid == 0) { in xmlHashGrow()
296 memcpy(&(table->table[key]), iter, sizeof(xmlHashEntry)); in xmlHashGrow()
297 table->table[key].next = NULL; in xmlHashGrow()
300 iter->next = table->table[key].next; in xmlHashGrow()
301 table->table[key].next = iter; in xmlHashGrow()
331 xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) { in xmlHashFree() argument
338 if (table == NULL) in xmlHashFree()
340 if (table->table) { in xmlHashFree()
341 nbElems = table->nbElems; in xmlHashFree()
342 for(i = 0; (i < table->size) && (nbElems > 0); i++) { in xmlHashFree()
343 iter = &(table->table[i]); in xmlHashFree()
351 if (table->dict == NULL) { in xmlHashFree()
367 xmlFree(table->table); in xmlHashFree()
369 if (table->dict) in xmlHashFree()
370 xmlDictFree(table->dict); in xmlHashFree()
371 xmlFree(table); in xmlHashFree()
398 xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata) { in xmlHashAddEntry() argument
399 return(xmlHashAddEntry3(table, name, NULL, NULL, userdata)); in xmlHashAddEntry()
415 xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, in xmlHashAddEntry2() argument
417 return(xmlHashAddEntry3(table, name, name2, NULL, userdata)); in xmlHashAddEntry2()
434 xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name, in xmlHashUpdateEntry() argument
436 return(xmlHashUpdateEntry3(table, name, NULL, NULL, userdata, f)); in xmlHashUpdateEntry()
454 xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, in xmlHashUpdateEntry2() argument
457 return(xmlHashUpdateEntry3(table, name, name2, NULL, userdata, f)); in xmlHashUpdateEntry2()
470 xmlHashLookup(xmlHashTablePtr table, const xmlChar *name) { in xmlHashLookup() argument
471 return(xmlHashLookup3(table, name, NULL, NULL)); in xmlHashLookup()
485 xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, in xmlHashLookup2() argument
487 return(xmlHashLookup3(table, name, name2, NULL)); in xmlHashLookup2()
501 xmlHashQLookup(xmlHashTablePtr table, const xmlChar *prefix, in xmlHashQLookup() argument
503 return(xmlHashQLookup3(table, prefix, name, NULL, NULL, NULL, NULL)); in xmlHashQLookup()
519 xmlHashQLookup2(xmlHashTablePtr table, const xmlChar *prefix, in xmlHashQLookup2() argument
522 return(xmlHashQLookup3(table, prefix, name, prefix2, name2, NULL, NULL)); in xmlHashQLookup2()
540 xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, in xmlHashAddEntry3() argument
547 if ((table == NULL) || (name == NULL)) in xmlHashAddEntry3()
553 if (table->dict) { in xmlHashAddEntry3()
554 if (!xmlDictOwns(table->dict, name)) { in xmlHashAddEntry3()
555 name = xmlDictLookup(table->dict, name, -1); in xmlHashAddEntry3()
559 if ((name2 != NULL) && (!xmlDictOwns(table->dict, name2))) { in xmlHashAddEntry3()
560 name2 = xmlDictLookup(table->dict, name2, -1); in xmlHashAddEntry3()
564 if ((name3 != NULL) && (!xmlDictOwns(table->dict, name3))) { in xmlHashAddEntry3()
565 name3 = xmlDictLookup(table->dict, name3, -1); in xmlHashAddEntry3()
574 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashAddEntry3()
575 if (table->table[key].valid == 0) { in xmlHashAddEntry3()
578 if (table->dict) { in xmlHashAddEntry3()
579 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashAddEntry3()
592 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashAddEntry3()
608 entry = &(table->table[key]); in xmlHashAddEntry3()
615 if (table->dict != NULL) { in xmlHashAddEntry3()
632 table->nbElems++; in xmlHashAddEntry3()
635 xmlHashGrow(table, MAX_HASH_LEN * table->size); in xmlHashAddEntry3()
656 xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, in xmlHashUpdateEntry3() argument
663 if ((table == NULL) || name == NULL) in xmlHashUpdateEntry3()
669 if (table->dict) { in xmlHashUpdateEntry3()
670 if (!xmlDictOwns(table->dict, name)) { in xmlHashUpdateEntry3()
671 name = xmlDictLookup(table->dict, name, -1); in xmlHashUpdateEntry3()
675 if ((name2 != NULL) && (!xmlDictOwns(table->dict, name2))) { in xmlHashUpdateEntry3()
676 name2 = xmlDictLookup(table->dict, name2, -1); in xmlHashUpdateEntry3()
680 if ((name3 != NULL) && (!xmlDictOwns(table->dict, name3))) { in xmlHashUpdateEntry3()
681 name3 = xmlDictLookup(table->dict, name3, -1); in xmlHashUpdateEntry3()
690 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashUpdateEntry3()
691 if (table->table[key].valid == 0) { in xmlHashUpdateEntry3()
694 if (table ->dict) { in xmlHashUpdateEntry3()
695 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashUpdateEntry3()
715 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashUpdateEntry3()
738 entry = &(table->table[key]); in xmlHashUpdateEntry3()
745 if (table->dict != NULL) { in xmlHashUpdateEntry3()
757 table->nbElems++; in xmlHashUpdateEntry3()
778 xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, in xmlHashLookup3() argument
783 if (table == NULL) in xmlHashLookup3()
787 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashLookup3()
788 if (table->table[key].valid == 0) in xmlHashLookup3()
790 if (table->dict) { in xmlHashLookup3()
791 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashLookup3()
798 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashLookup3()
822 xmlHashQLookup3(xmlHashTablePtr table, in xmlHashQLookup3() argument
829 if (table == NULL) in xmlHashQLookup3()
833 key = xmlHashComputeQKey(table, prefix, name, prefix2, in xmlHashQLookup3()
835 if (table->table[key].valid == 0) in xmlHashQLookup3()
837 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashQLookup3()
868 xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) { in xmlHashScan() argument
872 xmlHashScanFull (table, stubHashScannerFull, &stubdata); in xmlHashScan()
884 xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) { in xmlHashScanFull() argument
889 if (table == NULL) in xmlHashScanFull()
894 if (table->table) { in xmlHashScanFull()
895 for(i = 0; i < table->size; i++) { in xmlHashScanFull()
896 if (table->table[i].valid == 0) in xmlHashScanFull()
898 iter = &(table->table[i]); in xmlHashScanFull()
901 nb = table->nbElems; in xmlHashScanFull()
905 if (nb != table->nbElems) { in xmlHashScanFull()
907 if (iter == &(table->table[i])) { in xmlHashScanFull()
908 if (table->table[i].valid == 0) in xmlHashScanFull()
910 if (table->table[i].next != next) in xmlHashScanFull()
911 iter = &(table->table[i]); in xmlHashScanFull()
935 xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, in xmlHashScan3() argument
941 xmlHashScanFull3(table, name, name2, name3, stubHashScannerFull, in xmlHashScan3()
959 xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, in xmlHashScanFull3() argument
966 if (table == NULL) in xmlHashScanFull3()
971 if (table->table) { in xmlHashScanFull3()
972 for(i = 0; i < table->size; i++) { in xmlHashScanFull3()
973 if (table->table[i].valid == 0) in xmlHashScanFull3()
975 iter = &(table->table[i]); in xmlHashScanFull3()
1001 xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) { in xmlHashCopy() argument
1007 if (table == NULL) in xmlHashCopy()
1012 ret = xmlHashCreate(table->size); in xmlHashCopy()
1016 if (table->table) { in xmlHashCopy()
1017 for(i = 0; i < table->size; i++) { in xmlHashCopy()
1018 if (table->table[i].valid == 0) in xmlHashCopy()
1020 iter = &(table->table[i]); in xmlHashCopy()
1029 ret->nbElems = table->nbElems; in xmlHashCopy()
1043 xmlHashSize(xmlHashTablePtr table) { in xmlHashSize() argument
1044 if (table == NULL) in xmlHashSize()
1046 return(table->nbElems); in xmlHashSize()
1061 int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, in xmlHashRemoveEntry() argument
1063 return(xmlHashRemoveEntry3(table, name, NULL, NULL, f)); in xmlHashRemoveEntry()
1080 xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, in xmlHashRemoveEntry2() argument
1082 return(xmlHashRemoveEntry3(table, name, name2, NULL, f)); in xmlHashRemoveEntry2()
1100 xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, in xmlHashRemoveEntry3() argument
1106 if (table == NULL || name == NULL) in xmlHashRemoveEntry3()
1109 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashRemoveEntry3()
1110 if (table->table[key].valid == 0) { in xmlHashRemoveEntry3()
1113 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashRemoveEntry3()
1120 if (table->dict == NULL) { in xmlHashRemoveEntry3()
1136 memcpy(&(table->table[key]), entry, sizeof(xmlHashEntry)); in xmlHashRemoveEntry3()
1140 table->nbElems--; in xmlHashRemoveEntry3()