Lines Matching refs:table
52 struct _xmlHashEntry *table; member
63 xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, in xmlHashComputeKey() argument
84 return (value % table->size); in xmlHashComputeKey()
88 xmlHashComputeQKey(xmlHashTablePtr table, in xmlHashComputeQKey() argument
133 return (value % table->size); in xmlHashComputeQKey()
146 xmlHashTablePtr table; in xmlHashCreate() local
151 table = xmlMalloc(sizeof(xmlHashTable)); in xmlHashCreate()
152 if (table) { in xmlHashCreate()
153 table->dict = NULL; in xmlHashCreate()
154 table->size = size; in xmlHashCreate()
155 table->nbElems = 0; in xmlHashCreate()
156 table->table = xmlMalloc(size * sizeof(xmlHashEntry)); in xmlHashCreate()
157 if (table->table) { in xmlHashCreate()
158 memset(table->table, 0, size * sizeof(xmlHashEntry)); in xmlHashCreate()
159 return(table); in xmlHashCreate()
161 xmlFree(table); in xmlHashCreate()
177 xmlHashTablePtr table; in xmlHashCreateDict() local
179 table = xmlHashCreate(size); in xmlHashCreateDict()
180 if (table != NULL) { in xmlHashCreateDict()
181 table->dict = dict; in xmlHashCreateDict()
184 return(table); in xmlHashCreateDict()
197 xmlHashGrow(xmlHashTablePtr table, int size) { in xmlHashGrow() argument
206 if (table == NULL) in xmlHashGrow()
213 oldsize = table->size; in xmlHashGrow()
214 oldtable = table->table; in xmlHashGrow()
218 table->table = xmlMalloc(size * sizeof(xmlHashEntry)); in xmlHashGrow()
219 if (table->table == NULL) { in xmlHashGrow()
220 table->table = oldtable; in xmlHashGrow()
223 memset(table->table, 0, size * sizeof(xmlHashEntry)); in xmlHashGrow()
224 table->size = size; in xmlHashGrow()
235 key = xmlHashComputeKey(table, oldtable[i].name, oldtable[i].name2, in xmlHashGrow()
237 memcpy(&(table->table[key]), &(oldtable[i]), sizeof(xmlHashEntry)); in xmlHashGrow()
238 table->table[key].next = NULL; in xmlHashGrow()
250 key = xmlHashComputeKey(table, iter->name, iter->name2, in xmlHashGrow()
252 if (table->table[key].valid == 0) { in xmlHashGrow()
253 memcpy(&(table->table[key]), iter, sizeof(xmlHashEntry)); in xmlHashGrow()
254 table->table[key].next = NULL; in xmlHashGrow()
257 iter->next = table->table[key].next; in xmlHashGrow()
258 table->table[key].next = iter; in xmlHashGrow()
288 xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) { in xmlHashFree() argument
295 if (table == NULL) in xmlHashFree()
297 if (table->table) { in xmlHashFree()
298 nbElems = table->nbElems; in xmlHashFree()
299 for(i = 0; (i < table->size) && (nbElems > 0); i++) { in xmlHashFree()
300 iter = &(table->table[i]); in xmlHashFree()
308 if (table->dict == NULL) { in xmlHashFree()
325 xmlFree(table->table); in xmlHashFree()
327 if (table->dict) in xmlHashFree()
328 xmlDictFree(table->dict); in xmlHashFree()
329 xmlFree(table); in xmlHashFree()
344 xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata) { in xmlHashAddEntry() argument
345 return(xmlHashAddEntry3(table, name, NULL, NULL, userdata)); in xmlHashAddEntry()
361 xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, in xmlHashAddEntry2() argument
363 return(xmlHashAddEntry3(table, name, name2, NULL, userdata)); in xmlHashAddEntry2()
380 xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name, in xmlHashUpdateEntry() argument
382 return(xmlHashUpdateEntry3(table, name, NULL, NULL, userdata, f)); in xmlHashUpdateEntry()
400 xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, in xmlHashUpdateEntry2() argument
403 return(xmlHashUpdateEntry3(table, name, name2, NULL, userdata, f)); in xmlHashUpdateEntry2()
416 xmlHashLookup(xmlHashTablePtr table, const xmlChar *name) { in xmlHashLookup() argument
417 return(xmlHashLookup3(table, name, NULL, NULL)); in xmlHashLookup()
431 xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, in xmlHashLookup2() argument
433 return(xmlHashLookup3(table, name, name2, NULL)); in xmlHashLookup2()
447 xmlHashQLookup(xmlHashTablePtr table, const xmlChar *prefix, in xmlHashQLookup() argument
449 return(xmlHashQLookup3(table, prefix, name, NULL, NULL, NULL, NULL)); in xmlHashQLookup()
465 xmlHashQLookup2(xmlHashTablePtr table, const xmlChar *prefix, in xmlHashQLookup2() argument
468 return(xmlHashQLookup3(table, prefix, name, prefix2, name2, NULL, NULL)); in xmlHashQLookup2()
486 xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, in xmlHashAddEntry3() argument
493 if ((table == NULL) || (name == NULL)) in xmlHashAddEntry3()
499 if (table->dict) { in xmlHashAddEntry3()
500 if (!xmlDictOwns(table->dict, name)) { in xmlHashAddEntry3()
501 name = xmlDictLookup(table->dict, name, -1); in xmlHashAddEntry3()
505 if ((name2 != NULL) && (!xmlDictOwns(table->dict, name2))) { in xmlHashAddEntry3()
506 name2 = xmlDictLookup(table->dict, name2, -1); in xmlHashAddEntry3()
510 if ((name3 != NULL) && (!xmlDictOwns(table->dict, name3))) { in xmlHashAddEntry3()
511 name3 = xmlDictLookup(table->dict, name3, -1); in xmlHashAddEntry3()
520 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashAddEntry3()
521 if (table->table[key].valid == 0) { in xmlHashAddEntry3()
524 if (table->dict) { in xmlHashAddEntry3()
525 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashAddEntry3()
538 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashAddEntry3()
554 entry = &(table->table[key]); in xmlHashAddEntry3()
561 if (table->dict != NULL) { in xmlHashAddEntry3()
578 table->nbElems++; in xmlHashAddEntry3()
581 xmlHashGrow(table, MAX_HASH_LEN * table->size); in xmlHashAddEntry3()
602 xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, in xmlHashUpdateEntry3() argument
609 if ((table == NULL) || name == NULL) in xmlHashUpdateEntry3()
615 if (table->dict) { in xmlHashUpdateEntry3()
616 if (!xmlDictOwns(table->dict, name)) { in xmlHashUpdateEntry3()
617 name = xmlDictLookup(table->dict, name, -1); in xmlHashUpdateEntry3()
621 if ((name2 != NULL) && (!xmlDictOwns(table->dict, name2))) { in xmlHashUpdateEntry3()
622 name2 = xmlDictLookup(table->dict, name2, -1); in xmlHashUpdateEntry3()
626 if ((name3 != NULL) && (!xmlDictOwns(table->dict, name3))) { in xmlHashUpdateEntry3()
627 name3 = xmlDictLookup(table->dict, name3, -1); in xmlHashUpdateEntry3()
636 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashUpdateEntry3()
637 if (table->table[key].valid == 0) { in xmlHashUpdateEntry3()
640 if (table ->dict) { in xmlHashUpdateEntry3()
641 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashUpdateEntry3()
661 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashUpdateEntry3()
684 entry = &(table->table[key]); in xmlHashUpdateEntry3()
691 if (table->dict != NULL) { in xmlHashUpdateEntry3()
703 table->nbElems++; in xmlHashUpdateEntry3()
724 xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, in xmlHashLookup3() argument
729 if (table == NULL) in xmlHashLookup3()
733 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashLookup3()
734 if (table->table[key].valid == 0) in xmlHashLookup3()
736 if (table->dict) { in xmlHashLookup3()
737 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashLookup3()
744 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashLookup3()
768 xmlHashQLookup3(xmlHashTablePtr table, in xmlHashQLookup3() argument
775 if (table == NULL) in xmlHashQLookup3()
779 key = xmlHashComputeQKey(table, prefix, name, prefix2, in xmlHashQLookup3()
781 if (table->table[key].valid == 0) in xmlHashQLookup3()
783 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashQLookup3()
814 xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) { in xmlHashScan() argument
818 xmlHashScanFull (table, stubHashScannerFull, &stubdata); in xmlHashScan()
830 xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) { in xmlHashScanFull() argument
835 if (table == NULL) in xmlHashScanFull()
840 if (table->table) { in xmlHashScanFull()
841 for(i = 0; i < table->size; i++) { in xmlHashScanFull()
842 if (table->table[i].valid == 0) in xmlHashScanFull()
844 iter = &(table->table[i]); in xmlHashScanFull()
847 nb = table->nbElems; in xmlHashScanFull()
851 if (nb != table->nbElems) { in xmlHashScanFull()
853 if (iter == &(table->table[i])) { in xmlHashScanFull()
854 if (table->table[i].valid == 0) in xmlHashScanFull()
856 if (table->table[i].next != next) in xmlHashScanFull()
857 iter = &(table->table[i]); in xmlHashScanFull()
881 xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, in xmlHashScan3() argument
884 xmlHashScanFull3 (table, name, name2, name3, in xmlHashScan3()
902 xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, in xmlHashScanFull3() argument
909 if (table == NULL) in xmlHashScanFull3()
914 if (table->table) { in xmlHashScanFull3()
915 for(i = 0; i < table->size; i++) { in xmlHashScanFull3()
916 if (table->table[i].valid == 0) in xmlHashScanFull3()
918 iter = &(table->table[i]); in xmlHashScanFull3()
944 xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) { in xmlHashCopy() argument
950 if (table == NULL) in xmlHashCopy()
955 ret = xmlHashCreate(table->size); in xmlHashCopy()
956 if (table->table) { in xmlHashCopy()
957 for(i = 0; i < table->size; i++) { in xmlHashCopy()
958 if (table->table[i].valid == 0) in xmlHashCopy()
960 iter = &(table->table[i]); in xmlHashCopy()
969 ret->nbElems = table->nbElems; in xmlHashCopy()
983 xmlHashSize(xmlHashTablePtr table) { in xmlHashSize() argument
984 if (table == NULL) in xmlHashSize()
986 return(table->nbElems); in xmlHashSize()
1001 int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, in xmlHashRemoveEntry() argument
1003 return(xmlHashRemoveEntry3(table, name, NULL, NULL, f)); in xmlHashRemoveEntry()
1020 xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, in xmlHashRemoveEntry2() argument
1022 return(xmlHashRemoveEntry3(table, name, name2, NULL, f)); in xmlHashRemoveEntry2()
1040 xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, in xmlHashRemoveEntry3() argument
1046 if (table == NULL || name == NULL) in xmlHashRemoveEntry3()
1049 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashRemoveEntry3()
1050 if (table->table[key].valid == 0) { in xmlHashRemoveEntry3()
1053 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashRemoveEntry3()
1060 if (table->dict == NULL) { in xmlHashRemoveEntry3()
1076 memcpy(&(table->table[key]), entry, sizeof(xmlHashEntry)); in xmlHashRemoveEntry3()
1080 table->nbElems--; in xmlHashRemoveEntry3()