• Home
  • Raw
  • Download

Lines Matching full:table

52  * A single entry in the hash table
66 * The entire hash table
69 struct _xmlHashEntry *table; member
86 xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, in xmlHashComputeKey() argument
92 value = table->random_seed; in xmlHashComputeKey()
112 return (value % table->size); in xmlHashComputeKey()
119 xmlHashComputeQKey(xmlHashTablePtr table, in xmlHashComputeQKey() argument
127 value = table->random_seed; in xmlHashComputeQKey()
169 return (value % table->size); in xmlHashComputeQKey()
174 * @size: the size of the hash table
182 xmlHashTablePtr table; in xmlHashCreate() local
187 table = xmlMalloc(sizeof(xmlHashTable)); in xmlHashCreate()
188 if (table) { in xmlHashCreate()
189 table->dict = NULL; in xmlHashCreate()
190 table->size = size; in xmlHashCreate()
191 table->nbElems = 0; in xmlHashCreate()
192 table->table = xmlMalloc(size * sizeof(xmlHashEntry)); in xmlHashCreate()
193 if (table->table) { in xmlHashCreate()
194 memset(table->table, 0, size * sizeof(xmlHashEntry)); in xmlHashCreate()
196 table->random_seed = __xmlRandom(); in xmlHashCreate()
198 return(table); in xmlHashCreate()
200 xmlFree(table); in xmlHashCreate()
207 * @size: the size of the hash table
216 xmlHashTablePtr table; in xmlHashCreateDict() local
218 table = xmlHashCreate(size); in xmlHashCreateDict()
219 if (table != NULL) { in xmlHashCreateDict()
220 table->dict = dict; in xmlHashCreateDict()
223 return(table); in xmlHashCreateDict()
228 * @table: the hash table
229 * @size: the new size of the hash table
231 * resize the hash table
236 xmlHashGrow(xmlHashTablePtr table, int size) { in xmlHashGrow() argument
245 if (table == NULL) in xmlHashGrow()
252 oldsize = table->size; in xmlHashGrow()
253 oldtable = table->table; in xmlHashGrow()
257 table->table = xmlMalloc(size * sizeof(xmlHashEntry)); in xmlHashGrow()
258 if (table->table == NULL) { in xmlHashGrow()
259 table->table = oldtable; in xmlHashGrow()
262 memset(table->table, 0, size * sizeof(xmlHashEntry)); in xmlHashGrow()
263 table->size = size; in xmlHashGrow()
267 the main table. So instead, we run through the array twice, first in xmlHashGrow()
274 key = xmlHashComputeKey(table, oldtable[i].name, oldtable[i].name2, in xmlHashGrow()
276 memcpy(&(table->table[key]), &(oldtable[i]), sizeof(xmlHashEntry)); in xmlHashGrow()
277 table->table[key].next = NULL; in xmlHashGrow()
286 * put back the entry in the new table in xmlHashGrow()
289 key = xmlHashComputeKey(table, iter->name, iter->name2, in xmlHashGrow()
291 if (table->table[key].valid == 0) { in xmlHashGrow()
292 memcpy(&(table->table[key]), iter, sizeof(xmlHashEntry)); in xmlHashGrow()
293 table->table[key].next = NULL; in xmlHashGrow()
296 iter->next = table->table[key].next; in xmlHashGrow()
297 table->table[key].next = iter; in xmlHashGrow()
320 * @table: the hash table
323 * Free the hash @table and its contents. The userdata is
327 xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) { in xmlHashFree() argument
334 if (table == NULL) in xmlHashFree()
336 if (table->table) { in xmlHashFree()
337 nbElems = table->nbElems; in xmlHashFree()
338 for(i = 0; (i < table->size) && (nbElems > 0); i++) { in xmlHashFree()
339 iter = &(table->table[i]); in xmlHashFree()
347 if (table->dict == NULL) { in xmlHashFree()
363 xmlFree(table->table); in xmlHashFree()
365 if (table->dict) in xmlHashFree()
366 xmlDictFree(table->dict); in xmlHashFree()
367 xmlFree(table); in xmlHashFree()
372 * @entry: the hash table entry
375 * Free a hash table entry with xmlFree.
384 * @table: the hash table
388 * Add the @userdata to the hash @table. This can later be retrieved
394 xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata) { in xmlHashAddEntry() argument
395 return(xmlHashAddEntry3(table, name, NULL, NULL, userdata)); in xmlHashAddEntry()
400 * @table: the hash table
405 * Add the @userdata to the hash @table. This can later be retrieved
411 xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, in xmlHashAddEntry2() argument
413 return(xmlHashAddEntry3(table, name, name2, NULL, userdata)); in xmlHashAddEntry2()
418 * @table: the hash table
423 * Add the @userdata to the hash @table. This can later be retrieved
430 xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name, in xmlHashUpdateEntry() argument
432 return(xmlHashUpdateEntry3(table, name, NULL, NULL, userdata, f)); in xmlHashUpdateEntry()
437 * @table: the hash table
443 * Add the @userdata to the hash @table. This can later be retrieved
450 xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, in xmlHashUpdateEntry2() argument
453 return(xmlHashUpdateEntry3(table, name, name2, NULL, userdata, f)); in xmlHashUpdateEntry2()
458 * @table: the hash table
466 xmlHashLookup(xmlHashTablePtr table, const xmlChar *name) { in xmlHashLookup() argument
467 return(xmlHashLookup3(table, name, NULL, NULL)); in xmlHashLookup()
472 * @table: the hash table
481 xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, in xmlHashLookup2() argument
483 return(xmlHashLookup3(table, name, name2, NULL)); in xmlHashLookup2()
488 * @table: the hash table
497 xmlHashQLookup(xmlHashTablePtr table, const xmlChar *prefix, in xmlHashQLookup() argument
499 return(xmlHashQLookup3(table, prefix, name, NULL, NULL, NULL, NULL)); in xmlHashQLookup()
504 * @table: the hash table
515 xmlHashQLookup2(xmlHashTablePtr table, const xmlChar *prefix, in xmlHashQLookup2() argument
518 return(xmlHashQLookup3(table, prefix, name, prefix2, name2, NULL, NULL)); in xmlHashQLookup2()
523 * @table: the hash table
529 * Add the @userdata to the hash @table. This can later be retrieved
536 xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, in xmlHashAddEntry3() argument
543 if ((table == NULL) || (name == NULL)) in xmlHashAddEntry3()
549 if (table->dict) { in xmlHashAddEntry3()
550 if (!xmlDictOwns(table->dict, name)) { in xmlHashAddEntry3()
551 name = xmlDictLookup(table->dict, name, -1); in xmlHashAddEntry3()
555 if ((name2 != NULL) && (!xmlDictOwns(table->dict, name2))) { in xmlHashAddEntry3()
556 name2 = xmlDictLookup(table->dict, name2, -1); in xmlHashAddEntry3()
560 if ((name3 != NULL) && (!xmlDictOwns(table->dict, name3))) { in xmlHashAddEntry3()
561 name3 = xmlDictLookup(table->dict, name3, -1); in xmlHashAddEntry3()
570 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashAddEntry3()
571 if (table->table[key].valid == 0) { in xmlHashAddEntry3()
574 if (table->dict) { in xmlHashAddEntry3()
575 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashAddEntry3()
588 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashAddEntry3()
604 entry = &(table->table[key]); in xmlHashAddEntry3()
611 if (table->dict != NULL) { in xmlHashAddEntry3()
628 table->nbElems++; in xmlHashAddEntry3()
631 xmlHashGrow(table, MAX_HASH_LEN * table->size); in xmlHashAddEntry3()
638 * @table: the hash table
645 * Add the @userdata to the hash @table. This can later be retrieved
652 xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, in xmlHashUpdateEntry3() argument
659 if ((table == NULL) || name == NULL) in xmlHashUpdateEntry3()
665 if (table->dict) { in xmlHashUpdateEntry3()
666 if (!xmlDictOwns(table->dict, name)) { in xmlHashUpdateEntry3()
667 name = xmlDictLookup(table->dict, name, -1); in xmlHashUpdateEntry3()
671 if ((name2 != NULL) && (!xmlDictOwns(table->dict, name2))) { in xmlHashUpdateEntry3()
672 name2 = xmlDictLookup(table->dict, name2, -1); in xmlHashUpdateEntry3()
676 if ((name3 != NULL) && (!xmlDictOwns(table->dict, name3))) { in xmlHashUpdateEntry3()
677 name3 = xmlDictLookup(table->dict, name3, -1); in xmlHashUpdateEntry3()
686 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashUpdateEntry3()
687 if (table->table[key].valid == 0) { in xmlHashUpdateEntry3()
690 if (table ->dict) { in xmlHashUpdateEntry3()
691 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashUpdateEntry3()
711 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashUpdateEntry3()
734 entry = &(table->table[key]); in xmlHashUpdateEntry3()
741 if (table->dict != NULL) { in xmlHashUpdateEntry3()
753 table->nbElems++; in xmlHashUpdateEntry3()
764 * @table: the hash table
774 xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, in xmlHashLookup3() argument
779 if (table == NULL) in xmlHashLookup3()
783 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashLookup3()
784 if (table->table[key].valid == 0) in xmlHashLookup3()
786 if (table->dict) { in xmlHashLookup3()
787 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashLookup3()
794 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashLookup3()
805 * @table: the hash table
818 xmlHashQLookup3(xmlHashTablePtr table, in xmlHashQLookup3() argument
825 if (table == NULL) in xmlHashQLookup3()
829 key = xmlHashComputeQKey(table, prefix, name, prefix2, in xmlHashQLookup3()
831 if (table->table[key].valid == 0) in xmlHashQLookup3()
833 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashQLookup3()
857 * @table: the hash table
861 * Scan the hash @table and applied @f to each value.
864 xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) { in xmlHashScan() argument
868 xmlHashScanFull (table, stubHashScannerFull, &stubdata); in xmlHashScan()
873 * @table: the hash table
877 * Scan the hash @table and applied @f to each value.
880 xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) { in xmlHashScanFull() argument
885 if (table == NULL) in xmlHashScanFull()
890 if (table->table) { in xmlHashScanFull()
891 for(i = 0; i < table->size; i++) { in xmlHashScanFull()
892 if (table->table[i].valid == 0) in xmlHashScanFull()
894 iter = &(table->table[i]); in xmlHashScanFull()
897 nb = table->nbElems; in xmlHashScanFull()
901 if (nb != table->nbElems) { in xmlHashScanFull()
902 /* table was modified by the callback, be careful */ in xmlHashScanFull()
903 if (iter == &(table->table[i])) { in xmlHashScanFull()
904 if (table->table[i].valid == 0) in xmlHashScanFull()
906 if (table->table[i].next != next) in xmlHashScanFull()
907 iter = &(table->table[i]); in xmlHashScanFull()
919 * @table: the hash table
926 * Scan the hash @table and applied @f to each value matching
931 xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, in xmlHashScan3() argument
937 xmlHashScanFull3(table, name, name2, name3, stubHashScannerFull, in xmlHashScan3()
943 * @table: the hash table
950 * Scan the hash @table and applied @f to each value matching
955 xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, in xmlHashScanFull3() argument
962 if (table == NULL) in xmlHashScanFull3()
967 if (table->table) { in xmlHashScanFull3()
968 for(i = 0; i < table->size; i++) { in xmlHashScanFull3()
969 if (table->table[i].valid == 0) in xmlHashScanFull3()
971 iter = &(table->table[i]); in xmlHashScanFull3()
989 * @table: the hash table
992 * Scan the hash @table and applied @f to each value.
994 * Returns the new table or NULL in case of error.
997 xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) { in xmlHashCopy() argument
1003 if (table == NULL) in xmlHashCopy()
1008 ret = xmlHashCreate(table->size); in xmlHashCopy()
1012 if (table->table) { in xmlHashCopy()
1013 for(i = 0; i < table->size; i++) { in xmlHashCopy()
1014 if (table->table[i].valid == 0) in xmlHashCopy()
1016 iter = &(table->table[i]); in xmlHashCopy()
1025 ret->nbElems = table->nbElems; in xmlHashCopy()
1031 * @table: the hash table
1033 * Query the number of elements installed in the hash @table.
1035 * Returns the number of elements in the hash table or
1039 xmlHashSize(xmlHashTablePtr table) { in xmlHashSize() argument
1040 if (table == NULL) in xmlHashSize()
1042 return(table->nbElems); in xmlHashSize()
1047 * @table: the hash table
1052 * it from the hash @table. Existing userdata for this tuple will be removed
1057 int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, in xmlHashRemoveEntry() argument
1059 return(xmlHashRemoveEntry3(table, name, NULL, NULL, f)); in xmlHashRemoveEntry()
1064 * @table: the hash table
1070 * it from the hash @table. Existing userdata for this tuple will be removed
1076 xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, in xmlHashRemoveEntry2() argument
1078 return(xmlHashRemoveEntry3(table, name, name2, NULL, f)); in xmlHashRemoveEntry2()
1083 * @table: the hash table
1090 * it from the hash @table. Existing userdata for this tuple will be removed
1096 xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, in xmlHashRemoveEntry3() argument
1102 if (table == NULL || name == NULL) in xmlHashRemoveEntry3()
1105 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashRemoveEntry3()
1106 if (table->table[key].valid == 0) { in xmlHashRemoveEntry3()
1109 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashRemoveEntry3()
1116 if (table->dict == NULL) { in xmlHashRemoveEntry3()
1132 memcpy(&(table->table[key]), entry, sizeof(xmlHashEntry)); in xmlHashRemoveEntry3()
1136 table->nbElems--; in xmlHashRemoveEntry3()