• Home
  • Raw
  • Download

Lines Matching full:table

51  * A single entry in the hash table
65 * The entire hash table
68 struct _xmlHashEntry *table; member
82 xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, in xmlHashComputeKey() argument
88 value = table->random_seed; in xmlHashComputeKey()
108 return (value % table->size); in xmlHashComputeKey()
112 xmlHashComputeQKey(xmlHashTablePtr table, in xmlHashComputeQKey() argument
120 value = table->random_seed; in xmlHashComputeQKey()
162 return (value % table->size); in xmlHashComputeQKey()
167 * @size: the size of the hash table
175 xmlHashTablePtr table; in xmlHashCreate() local
180 table = xmlMalloc(sizeof(xmlHashTable)); in xmlHashCreate()
181 if (table) { in xmlHashCreate()
182 table->dict = NULL; in xmlHashCreate()
183 table->size = size; in xmlHashCreate()
184 table->nbElems = 0; in xmlHashCreate()
185 table->table = xmlMalloc(size * sizeof(xmlHashEntry)); in xmlHashCreate()
186 if (table->table) { in xmlHashCreate()
187 memset(table->table, 0, size * sizeof(xmlHashEntry)); in xmlHashCreate()
189 table->random_seed = __xmlRandom(); in xmlHashCreate()
191 return(table); in xmlHashCreate()
193 xmlFree(table); in xmlHashCreate()
200 * @size: the size of the hash table
209 xmlHashTablePtr table; in xmlHashCreateDict() local
211 table = xmlHashCreate(size); in xmlHashCreateDict()
212 if (table != NULL) { in xmlHashCreateDict()
213 table->dict = dict; in xmlHashCreateDict()
216 return(table); in xmlHashCreateDict()
221 * @table: the hash table
222 * @size: the new size of the hash table
224 * resize the hash table
229 xmlHashGrow(xmlHashTablePtr table, int size) { in xmlHashGrow() argument
238 if (table == NULL) in xmlHashGrow()
245 oldsize = table->size; in xmlHashGrow()
246 oldtable = table->table; in xmlHashGrow()
250 table->table = xmlMalloc(size * sizeof(xmlHashEntry)); in xmlHashGrow()
251 if (table->table == NULL) { in xmlHashGrow()
252 table->table = oldtable; in xmlHashGrow()
255 memset(table->table, 0, size * sizeof(xmlHashEntry)); in xmlHashGrow()
256 table->size = size; in xmlHashGrow()
260 the main table. So instead, we run through the array twice, first in xmlHashGrow()
267 key = xmlHashComputeKey(table, oldtable[i].name, oldtable[i].name2, in xmlHashGrow()
269 memcpy(&(table->table[key]), &(oldtable[i]), sizeof(xmlHashEntry)); in xmlHashGrow()
270 table->table[key].next = NULL; in xmlHashGrow()
279 * put back the entry in the new table in xmlHashGrow()
282 key = xmlHashComputeKey(table, iter->name, iter->name2, in xmlHashGrow()
284 if (table->table[key].valid == 0) { in xmlHashGrow()
285 memcpy(&(table->table[key]), iter, sizeof(xmlHashEntry)); in xmlHashGrow()
286 table->table[key].next = NULL; in xmlHashGrow()
289 iter->next = table->table[key].next; in xmlHashGrow()
290 table->table[key].next = iter; in xmlHashGrow()
313 * @table: the hash table
316 * Free the hash @table and its contents. The userdata is
320 xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) { in xmlHashFree() argument
327 if (table == NULL) in xmlHashFree()
329 if (table->table) { in xmlHashFree()
330 nbElems = table->nbElems; in xmlHashFree()
331 for(i = 0; (i < table->size) && (nbElems > 0); i++) { in xmlHashFree()
332 iter = &(table->table[i]); in xmlHashFree()
340 if (table->dict == NULL) { in xmlHashFree()
356 xmlFree(table->table); in xmlHashFree()
358 if (table->dict) in xmlHashFree()
359 xmlDictFree(table->dict); in xmlHashFree()
360 xmlFree(table); in xmlHashFree()
365 * @entry: the hash table entry
368 * Free a hash table entry with xmlFree.
377 * @table: the hash table
381 * Add the @userdata to the hash @table. This can later be retrieved
387 xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata) { in xmlHashAddEntry() argument
388 return(xmlHashAddEntry3(table, name, NULL, NULL, userdata)); in xmlHashAddEntry()
393 * @table: the hash table
398 * Add the @userdata to the hash @table. This can later be retrieved
404 xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, in xmlHashAddEntry2() argument
406 return(xmlHashAddEntry3(table, name, name2, NULL, userdata)); in xmlHashAddEntry2()
411 * @table: the hash table
416 * Add the @userdata to the hash @table. This can later be retrieved
423 xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name, in xmlHashUpdateEntry() argument
425 return(xmlHashUpdateEntry3(table, name, NULL, NULL, userdata, f)); in xmlHashUpdateEntry()
430 * @table: the hash table
436 * Add the @userdata to the hash @table. This can later be retrieved
443 xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, in xmlHashUpdateEntry2() argument
446 return(xmlHashUpdateEntry3(table, name, name2, NULL, userdata, f)); in xmlHashUpdateEntry2()
451 * @table: the hash table
459 xmlHashLookup(xmlHashTablePtr table, const xmlChar *name) { in xmlHashLookup() argument
460 return(xmlHashLookup3(table, name, NULL, NULL)); in xmlHashLookup()
465 * @table: the hash table
474 xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, in xmlHashLookup2() argument
476 return(xmlHashLookup3(table, name, name2, NULL)); in xmlHashLookup2()
481 * @table: the hash table
490 xmlHashQLookup(xmlHashTablePtr table, const xmlChar *prefix, in xmlHashQLookup() argument
492 return(xmlHashQLookup3(table, prefix, name, NULL, NULL, NULL, NULL)); in xmlHashQLookup()
497 * @table: the hash table
508 xmlHashQLookup2(xmlHashTablePtr table, const xmlChar *prefix, in xmlHashQLookup2() argument
511 return(xmlHashQLookup3(table, prefix, name, prefix2, name2, NULL, NULL)); in xmlHashQLookup2()
516 * @table: the hash table
522 * Add the @userdata to the hash @table. This can later be retrieved
529 xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, in xmlHashAddEntry3() argument
536 if ((table == NULL) || (name == NULL)) in xmlHashAddEntry3()
542 if (table->dict) { in xmlHashAddEntry3()
543 if (!xmlDictOwns(table->dict, name)) { in xmlHashAddEntry3()
544 name = xmlDictLookup(table->dict, name, -1); in xmlHashAddEntry3()
548 if ((name2 != NULL) && (!xmlDictOwns(table->dict, name2))) { in xmlHashAddEntry3()
549 name2 = xmlDictLookup(table->dict, name2, -1); in xmlHashAddEntry3()
553 if ((name3 != NULL) && (!xmlDictOwns(table->dict, name3))) { in xmlHashAddEntry3()
554 name3 = xmlDictLookup(table->dict, name3, -1); in xmlHashAddEntry3()
563 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashAddEntry3()
564 if (table->table[key].valid == 0) { in xmlHashAddEntry3()
567 if (table->dict) { in xmlHashAddEntry3()
568 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashAddEntry3()
581 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashAddEntry3()
597 entry = &(table->table[key]); in xmlHashAddEntry3()
604 if (table->dict != NULL) { in xmlHashAddEntry3()
621 table->nbElems++; in xmlHashAddEntry3()
624 xmlHashGrow(table, MAX_HASH_LEN * table->size); in xmlHashAddEntry3()
631 * @table: the hash table
638 * Add the @userdata to the hash @table. This can later be retrieved
645 xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, in xmlHashUpdateEntry3() argument
652 if ((table == NULL) || name == NULL) in xmlHashUpdateEntry3()
658 if (table->dict) { in xmlHashUpdateEntry3()
659 if (!xmlDictOwns(table->dict, name)) { in xmlHashUpdateEntry3()
660 name = xmlDictLookup(table->dict, name, -1); in xmlHashUpdateEntry3()
664 if ((name2 != NULL) && (!xmlDictOwns(table->dict, name2))) { in xmlHashUpdateEntry3()
665 name2 = xmlDictLookup(table->dict, name2, -1); in xmlHashUpdateEntry3()
669 if ((name3 != NULL) && (!xmlDictOwns(table->dict, name3))) { in xmlHashUpdateEntry3()
670 name3 = xmlDictLookup(table->dict, name3, -1); in xmlHashUpdateEntry3()
679 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashUpdateEntry3()
680 if (table->table[key].valid == 0) { in xmlHashUpdateEntry3()
683 if (table ->dict) { in xmlHashUpdateEntry3()
684 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashUpdateEntry3()
704 for (insert = &(table->table[key]); insert->next != NULL; in xmlHashUpdateEntry3()
727 entry = &(table->table[key]); in xmlHashUpdateEntry3()
734 if (table->dict != NULL) { in xmlHashUpdateEntry3()
746 table->nbElems++; in xmlHashUpdateEntry3()
757 * @table: the hash table
767 xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, in xmlHashLookup3() argument
772 if (table == NULL) in xmlHashLookup3()
776 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashLookup3()
777 if (table->table[key].valid == 0) in xmlHashLookup3()
779 if (table->dict) { in xmlHashLookup3()
780 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashLookup3()
787 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashLookup3()
798 * @table: the hash table
811 xmlHashQLookup3(xmlHashTablePtr table, in xmlHashQLookup3() argument
818 if (table == NULL) in xmlHashQLookup3()
822 key = xmlHashComputeQKey(table, prefix, name, prefix2, in xmlHashQLookup3()
824 if (table->table[key].valid == 0) in xmlHashQLookup3()
826 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashQLookup3()
850 * @table: the hash table
854 * Scan the hash @table and applied @f to each value.
857 xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) { in xmlHashScan() argument
861 xmlHashScanFull (table, stubHashScannerFull, &stubdata); in xmlHashScan()
866 * @table: the hash table
870 * Scan the hash @table and applied @f to each value.
873 xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) { in xmlHashScanFull() argument
878 if (table == NULL) in xmlHashScanFull()
883 if (table->table) { in xmlHashScanFull()
884 for(i = 0; i < table->size; i++) { in xmlHashScanFull()
885 if (table->table[i].valid == 0) in xmlHashScanFull()
887 iter = &(table->table[i]); in xmlHashScanFull()
890 nb = table->nbElems; in xmlHashScanFull()
894 if (nb != table->nbElems) { in xmlHashScanFull()
895 /* table was modified by the callback, be careful */ in xmlHashScanFull()
896 if (iter == &(table->table[i])) { in xmlHashScanFull()
897 if (table->table[i].valid == 0) in xmlHashScanFull()
899 if (table->table[i].next != next) in xmlHashScanFull()
900 iter = &(table->table[i]); in xmlHashScanFull()
912 * @table: the hash table
919 * Scan the hash @table and applied @f to each value matching
924 xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, in xmlHashScan3() argument
930 xmlHashScanFull3(table, name, name2, name3, stubHashScannerFull, in xmlHashScan3()
936 * @table: the hash table
943 * Scan the hash @table and applied @f to each value matching
948 xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, in xmlHashScanFull3() argument
955 if (table == NULL) in xmlHashScanFull3()
960 if (table->table) { in xmlHashScanFull3()
961 for(i = 0; i < table->size; i++) { in xmlHashScanFull3()
962 if (table->table[i].valid == 0) in xmlHashScanFull3()
964 iter = &(table->table[i]); in xmlHashScanFull3()
982 * @table: the hash table
985 * Scan the hash @table and applied @f to each value.
987 * Returns the new table or NULL in case of error.
990 xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) { in xmlHashCopy() argument
996 if (table == NULL) in xmlHashCopy()
1001 ret = xmlHashCreate(table->size); in xmlHashCopy()
1005 if (table->table) { in xmlHashCopy()
1006 for(i = 0; i < table->size; i++) { in xmlHashCopy()
1007 if (table->table[i].valid == 0) in xmlHashCopy()
1009 iter = &(table->table[i]); in xmlHashCopy()
1018 ret->nbElems = table->nbElems; in xmlHashCopy()
1024 * @table: the hash table
1026 * Query the number of elements installed in the hash @table.
1028 * Returns the number of elements in the hash table or
1032 xmlHashSize(xmlHashTablePtr table) { in xmlHashSize() argument
1033 if (table == NULL) in xmlHashSize()
1035 return(table->nbElems); in xmlHashSize()
1040 * @table: the hash table
1045 * it from the hash @table. Existing userdata for this tuple will be removed
1050 int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, in xmlHashRemoveEntry() argument
1052 return(xmlHashRemoveEntry3(table, name, NULL, NULL, f)); in xmlHashRemoveEntry()
1057 * @table: the hash table
1063 * it from the hash @table. Existing userdata for this tuple will be removed
1069 xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, in xmlHashRemoveEntry2() argument
1071 return(xmlHashRemoveEntry3(table, name, name2, NULL, f)); in xmlHashRemoveEntry2()
1076 * @table: the hash table
1083 * it from the hash @table. Existing userdata for this tuple will be removed
1089 xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, in xmlHashRemoveEntry3() argument
1095 if (table == NULL || name == NULL) in xmlHashRemoveEntry3()
1098 key = xmlHashComputeKey(table, name, name2, name3); in xmlHashRemoveEntry3()
1099 if (table->table[key].valid == 0) { in xmlHashRemoveEntry3()
1102 for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { in xmlHashRemoveEntry3()
1109 if (table->dict == NULL) { in xmlHashRemoveEntry3()
1125 memcpy(&(table->table[key]), entry, sizeof(xmlHashEntry)); in xmlHashRemoveEntry3()
1129 table->nbElems--; in xmlHashRemoveEntry3()