ReactOS 0.4.16-dev-2132-g3885311
hash.h File Reference
#include <libxml/xmlversion.h>
#include <libxml/dict.h>
#include <libxml/xmlstring.h>
Include dependency graph for hash.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define XML_CAST_FPTR(fptr)   fptr
 

Typedefs

typedef struct _xmlHashTable xmlHashTable
 
typedef xmlHashTablexmlHashTablePtr
 
: the name associated

xmlHashScannerFull: @payload: the data in the hash @data: extra scanner data

typedef void(* xmlHashDeallocator) (void *payload, const xmlChar *name)
 
typedef void *(* xmlHashCopier) (void *payload, const xmlChar *name)
 
typedef void(* xmlHashScanner) (void *payload, void *data, const xmlChar *name)
 

3: the third name associated

Callback when scanning data in a hash with the full scanner.

typedef void(* xmlHashScannerFull) (void *payload, void *data, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
 
XMLPUBFUN xmlHashTablePtr xmlHashCreate (int size)
 
XMLPUBFUN xmlHashTablePtr xmlHashCreateDict (int size, xmlDictPtr dict)
 
XMLPUBFUN void xmlHashFree (xmlHashTablePtr hash, xmlHashDeallocator dealloc)
 
XMLPUBFUN void xmlHashDefaultDeallocator (void *entry, const xmlChar *name)
 
XMLPUBFUN int xmlHashAddEntry (xmlHashTablePtr hash, const xmlChar *name, void *userdata)
 
XMLPUBFUN int xmlHashUpdateEntry (xmlHashTablePtr hash, const xmlChar *name, void *userdata, xmlHashDeallocator dealloc)
 
XMLPUBFUN int xmlHashAddEntry2 (xmlHashTablePtr hash, const xmlChar *name, const xmlChar *name2, void *userdata)
 
XMLPUBFUN int xmlHashUpdateEntry2 (xmlHashTablePtr hash, const xmlChar *name, const xmlChar *name2, void *userdata, xmlHashDeallocator dealloc)
 
XMLPUBFUN int xmlHashAddEntry3 (xmlHashTablePtr hash, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata)
 
XMLPUBFUN int xmlHashUpdateEntry3 (xmlHashTablePtr hash, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata, xmlHashDeallocator dealloc)
 
XMLPUBFUN int xmlHashRemoveEntry (xmlHashTablePtr hash, const xmlChar *name, xmlHashDeallocator dealloc)
 
XMLPUBFUN int xmlHashRemoveEntry2 (xmlHashTablePtr hash, const xmlChar *name, const xmlChar *name2, xmlHashDeallocator dealloc)
 
XMLPUBFUN int xmlHashRemoveEntry3 (xmlHashTablePtr hash, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashDeallocator dealloc)
 
XMLPUBFUN voidxmlHashLookup (xmlHashTablePtr hash, const xmlChar *name)
 
XMLPUBFUN voidxmlHashLookup2 (xmlHashTablePtr hash, const xmlChar *name, const xmlChar *name2)
 
XMLPUBFUN voidxmlHashLookup3 (xmlHashTablePtr hash, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
 
XMLPUBFUN voidxmlHashQLookup (xmlHashTablePtr hash, const xmlChar *prefix, const xmlChar *name)
 
XMLPUBFUN voidxmlHashQLookup2 (xmlHashTablePtr hash, const xmlChar *prefix, const xmlChar *name, const xmlChar *prefix2, const xmlChar *name2)
 
XMLPUBFUN voidxmlHashQLookup3 (xmlHashTablePtr hash, const xmlChar *prefix, const xmlChar *name, const xmlChar *prefix2, const xmlChar *name2, const xmlChar *prefix3, const xmlChar *name3)
 
XMLPUBFUN xmlHashTablePtr xmlHashCopy (xmlHashTablePtr hash, xmlHashCopier copy)
 
XMLPUBFUN int xmlHashSize (xmlHashTablePtr hash)
 
XMLPUBFUN void xmlHashScan (xmlHashTablePtr hash, xmlHashScanner scan, void *data)
 
XMLPUBFUN void xmlHashScan3 (xmlHashTablePtr hash, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashScanner scan, void *data)
 
XMLPUBFUN void xmlHashScanFull (xmlHashTablePtr hash, xmlHashScannerFull scan, void *data)
 
XMLPUBFUN void xmlHashScanFull3 (xmlHashTablePtr hash, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashScannerFull scan, void *data)
 

Macro Definition Documentation

◆ XML_CAST_FPTR

#define XML_CAST_FPTR (   fptr)    fptr

XML_CAST_FPTR: @fptr: pointer to a function

Macro to do a casting from an object pointer to a function pointer without encountering a warning from gcc

define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) This macro violated ISO C aliasing rules (gcc4 on s390 broke) so it is disabled now

Definition at line 48 of file hash.h.

Typedef Documentation

◆ xmlHashCopier

typedef void *(* xmlHashCopier) (void *payload, const xmlChar *name)

Definition at line 70 of file hash.h.

◆ xmlHashDeallocator

typedef void(* xmlHashDeallocator) (void *payload, const xmlChar *name)

Definition at line 60 of file hash.h.

◆ xmlHashScanner

typedef void(* xmlHashScanner) (void *payload, void *data, const xmlChar *name)

Definition at line 79 of file hash.h.

◆ xmlHashScannerFull

typedef void(* xmlHashScannerFull) (void *payload, void *data, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)

Definition at line 90 of file hash.h.

◆ xmlHashTable

Definition at line 25 of file hash.h.

◆ xmlHashTablePtr

Definition at line 26 of file hash.h.

Function Documentation

◆ xmlHashAddEntry()

XMLPUBFUN int xmlHashAddEntry ( xmlHashTablePtr  hash,
const xmlChar key,
void payload 
)

xmlHashAddEntry: @hash: hash table @key: string key @payload: pointer to the payload

Add a hash table entry. If an entry with this key already exists, payload will not be updated and -1 is returned. This return value can't be distinguished from out-of-memory errors, so this function should be used with care.

Returns 0 on success and -1 in case of error.

Definition at line 621 of file hash.c.

621 {
622 return(xmlHashUpdateInternal(hash, key, NULL, NULL, payload, NULL, 0));
623}
#define NULL
Definition: types.h:112
static ATTRIBUTE_NO_SANITIZE_INTEGER int xmlHashUpdateInternal(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, const xmlChar *key3, void *payload, xmlHashDeallocator dealloc, int update)
Definition: hash.c:425
Definition: _hash_fun.h:40
Definition: copy.c:22

Referenced by cache_add_entry(), xmlAddID(), xmlAddNotationDecl(), xmlAddRef(), xsltGetExtData(), xsltInitCtxtExt(), xsltInitCtxtKey(), xsltNamespaceAlias(), xsltRegisterExtModuleFull(), and xsltStyleInitializeStylesheetModule().

◆ xmlHashAddEntry2()

XMLPUBFUN int xmlHashAddEntry2 ( xmlHashTablePtr  hash,
const xmlChar key,
const xmlChar key2,
void payload 
)

xmlHashAddEntry2: @hash: hash table @key: first string key @key2: second string key @payload: pointer to the payload

Add a hash table entry with two strings as key.

See xmlHashAddEntry.

Returns 0 on success and -1 in case of error.

Definition at line 639 of file hash.c.

640 {
641 return(xmlHashUpdateInternal(hash, key, key2, NULL, payload, NULL, 0));
642}

Referenced by xmlAddElementDecl(), xmlAddSpecialAttr(), xmlGetDtdElementDesc2(), xsltAddTemplate(), xsltDocumentElem(), xsltEvalGlobalVariables(), xsltParseStylesheetAttributeSet(), xsltParseStylesheetOutput(), xsltParseStylesheetPreserveSpace(), xsltParseStylesheetStripSpace(), xsltProcessUserParamInternal(), xsltRegisterExtElement(), xsltRegisterExtFunction(), and xsltResolveSASCallback().

◆ xmlHashAddEntry3()

XMLPUBFUN int xmlHashAddEntry3 ( xmlHashTablePtr  hash,
const xmlChar key,
const xmlChar key2,
const xmlChar key3,
void payload 
)

xmlHashAddEntry3: @hash: hash table @key: first string key @key2: second string key @key3: third string key @payload: pointer to the payload

Add a hash table entry with three strings as key.

See xmlHashAddEntry.

Returns 0 on success and -1 in case of error.

Definition at line 659 of file hash.c.

661 {
662 return(xmlHashUpdateInternal(hash, key, key2, key3, payload, NULL, 0));
663}

Referenced by xmlAddAttributeDecl(), xmlHashCopy(), and xsltAddTemplate().

◆ xmlHashCopy()

XMLPUBFUN xmlHashTablePtr xmlHashCopy ( xmlHashTablePtr  hash,
xmlHashCopier  copy 
)

xmlHashCopy: @hash: hash table @copy: copier function for items in the hash

Copy the hash @table using @copy to copy payloads.

Returns the new table or NULL if a memory allocation failed.

Definition at line 1050 of file hash.c.

1050 {
1051 const xmlHashEntry *entry, *end;
1053
1054 if ((hash == NULL) || (copy == NULL))
1055 return(NULL);
1056
1057 ret = xmlHashCreate(hash->size);
1058 if (ret == NULL)
1059 return(NULL);
1060
1061 if (hash->size == 0)
1062 return(ret);
1063
1064 end = &hash->table[hash->size];
1065
1066 for (entry = hash->table; entry < end; entry++) {
1067 if (entry->hashValue != 0)
1068 xmlHashAddEntry3(ret, entry->key, entry->key2, entry->key3,
1069 copy(entry->payload, entry->key));
1070 }
1071
1072 return(ret);
1073}
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
return ret
Definition: mutex.c:146
GLuint GLuint end
Definition: gl.h:1545
uint32_t entry
Definition: isohybrid.c:63
xmlHashTablePtr xmlHashCreate(int size)
Definition: hash.c:160
int xmlHashAddEntry3(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, const xmlChar *key3, void *payload)
Definition: hash.c:659

◆ xmlHashCreate()

XMLPUBFUN xmlHashTablePtr xmlHashCreate ( int  size)

xmlHashCreate: @size: initial size of the hash table

Create a new hash table. Set size to zero if the number of entries can't be estimated.

Returns the newly created object, or NULL if a memory allocation failed.

Definition at line 160 of file hash.c.

160 {
162
164
165 hash = xmlMalloc(sizeof(*hash));
166 if (hash == NULL)
167 return(NULL);
168 hash->dict = NULL;
169 hash->size = 0;
170 hash->table = NULL;
171 hash->nbElems = 0;
172 hash->randomSeed = xmlRandom();
173#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
174 hash->randomSeed = 0;
175#endif
176
177 /*
178 * Unless a larger size is passed, the backing table is created
179 * lazily with MIN_HASH_SIZE capacity. In practice, there are many
180 * hash tables which are never filled.
181 */
182 if (size > MIN_HASH_SIZE) {
183 unsigned newSize = MIN_HASH_SIZE * 2;
184
185 while ((newSize < (unsigned) size) && (newSize < MAX_HASH_SIZE))
186 newSize *= 2;
187
188 if (xmlHashGrow(hash, newSize) != 0) {
189 xmlFree(hash);
190 return(NULL);
191 }
192 }
193
194 return(hash);
195}
GLsizeiptr size
Definition: glext.h:5919
unsigned xmlRandom(void)
Definition: dict.c:951
xmlFreeFunc xmlFree
Definition: globals.c:184
xmlMallocFunc xmlMalloc
Definition: globals.c:193
#define MIN_HASH_SIZE
Definition: hash.c:30
static int xmlHashGrow(xmlHashTablePtr hash, unsigned size)
Definition: hash.c:354
#define MAX_HASH_SIZE
Definition: hash.c:31
XML_GLOBALS_PARSER XMLPUBFUN void xmlInitParser(void)
Definition: threads.c:569

Referenced by SchemaCache_create(), xmlHashCopy(), xmlHashCreateDict(), xsltAddTemplate(), xsltApplyStylesheetInternal(), xsltDocumentElem(), xsltGatherNamespaces(), xsltGetExtData(), xsltInitCtxtExt(), xsltNamespaceAlias(), xsltNewKeyTable(), xsltParseStylesheetAttributeSet(), xsltParseStylesheetOutput(), xsltParseStylesheetPreserveSpace(), xsltParseStylesheetStripSpace(), xsltProcessUserParamInternal(), xsltRegisterExtElement(), xsltRegisterExtFunction(), xsltRegisterExtModuleElement(), xsltRegisterExtModuleFull(), xsltRegisterExtModuleFunction(), xsltRegisterExtModuleTopLevel(), xsltResolveStylesheetAttributeSet(), and xsltStyleInitializeStylesheetModule().

◆ xmlHashCreateDict()

XMLPUBFUN xmlHashTablePtr xmlHashCreateDict ( int  size,
xmlDictPtr  dict 
)

xmlHashCreateDict: @size: the size of the hash table @dict: a dictionary to use for the hash

Create a new hash table backed by a dictionary. This can reduce resource usage considerably if most keys passed to API functions originate from this dictionary.

Returns the newly created object, or NULL if a memory allocation failed.

Definition at line 209 of file hash.c.

209 {
211
213 if (hash != NULL) {
214 hash->dict = dict;
215 xmlDictReference(dict);
216 }
217 return(hash);
218}
int xmlDictReference(xmlDictPtr dict)
Definition: dict.c:317

Referenced by xmlAddAttributeDecl(), xmlAddDefAttrs(), xmlAddElementDecl(), xmlAddID(), xmlAddNotationDecl(), xmlAddRef(), xmlAddSpecialAttr(), and xmlGetDtdElementDesc2().

◆ xmlHashDefaultDeallocator()

XMLPUBFUN void xmlHashDefaultDeallocator ( void entry,
const xmlChar name 
)

◆ xmlHashFree()

XMLPUBFUN void xmlHashFree ( xmlHashTablePtr  hash,
xmlHashDeallocator  dealloc 
)

xmlHashFree: @hash: hash table @dealloc: deallocator function or NULL

Free the hash and its contents. The payload is deallocated with @dealloc if provided.

Definition at line 229 of file hash.c.

229 {
230 if (hash == NULL)
231 return;
232
233 if (hash->table) {
234 const xmlHashEntry *end = &hash->table[hash->size];
235 const xmlHashEntry *entry;
236
237 for (entry = hash->table; entry < end; entry++) {
238 if (entry->hashValue == 0)
239 continue;
240 if ((dealloc != NULL) && (entry->payload != NULL))
241 dealloc(entry->payload, entry->key);
242 if (hash->dict == NULL) {
243 if (entry->key)
244 xmlFree(entry->key);
245 if (entry->key2)
246 xmlFree(entry->key2);
247 if (entry->key3)
248 xmlFree(entry->key3);
249 }
250 }
251
252 xmlFree(hash->table);
253 }
254
255 if (hash->dict)
256 xmlDictFree(hash->dict);
257
258 xmlFree(hash);
259}
void dealloc(int i, int no_throw)
Definition: ehthrow.cxx:33
void xmlDictFree(xmlDictPtr dict)
Definition: dict.c:333

Referenced by schema_cache_Release(), xmlCleanSpecialAttr(), xmlCtxtReset(), xmlFreeAttributeTable(), xmlFreeElementTable(), xmlFreeIDTable(), xmlFreeNotationTable(), xmlFreeParserCtxt(), xmlFreeRefTable(), xsltCleanupGlobals(), xsltFreeAttributeSetsHashes(), xsltFreeCtxtExts(), xsltFreeGlobalVariables(), xsltFreeKeyTable(), xsltFreeNamespaceAliasHashes(), xsltFreeStylesheet(), xsltFreeTemplateHashes(), xsltResolveStylesheetAttributeSet(), xsltShutdownCtxtExts(), xsltShutdownExts(), xsltUnregisterAllExtModuleElement(), xsltUnregisterAllExtModuleFunction(), xsltUnregisterAllExtModules(), and xsltUnregisterAllExtModuleTopLevel().

◆ xmlHashLookup()

XMLPUBFUN void * xmlHashLookup ( xmlHashTablePtr  hash,
const xmlChar key 
)

xmlHashLookup: @hash: hash table @key: string key

Find the entry specified by @key.

Returns a pointer to the payload or NULL if no entry was found.

Definition at line 739 of file hash.c.

739 {
740 return(xmlHashLookup3(hash, key, NULL, NULL));
741}
void * xmlHashLookup3(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, const xmlChar *key3)
Definition: hash.c:806

Referenced by cache_copy(), get_entry(), lookup_schema_elemDecl(), schema_cache_get(), xmlAddRef(), xmlGetDtdNotationDesc(), xmlGetID(), xmlGetRefs(), xmlRemoveID(), xmlRemoveRef(), xsltApplySequenceConstructor(), xsltCheckInstructionElement(), xsltCheckParentElement(), xsltCopyNamespaceList(), xsltGatherNamespaces(), xsltGetExtData(), xsltGetExtInfo(), xsltGetKey(), xsltGetNamespace(), xsltInitCtxtExt(), xsltInitCtxtKey(), xsltRegisterExtModuleFull(), xsltRegisterExtPrefix(), xsltStyleGetExtData(), and xsltStyleInitializeStylesheetModule().

◆ xmlHashLookup2()

◆ xmlHashLookup3()

XMLPUBFUN void * xmlHashLookup3 ( xmlHashTablePtr  hash,
const xmlChar key,
const xmlChar key2,
const xmlChar key3 
)

xmlHashLookup3: @hash: hash table @key: first string key @key2: second string key @key3: third string key

Find the payload specified by the (@key, @key2, @key3) tuple.

Returns a pointer to the payload or NULL if no entry was found.

Definition at line 806 of file hash.c.

807 {
808 const xmlHashEntry *entry;
809 unsigned hashValue;
810 int found;
811
812 if ((hash == NULL) || (hash->size == 0) || (key == NULL))
813 return(NULL);
814 hashValue = xmlHashValue(hash->randomSeed, key, key2, key3, NULL);
815 entry = xmlHashFindEntry(hash, key, key2, key3, hashValue, &found);
816 if (found)
817 return(entry->payload);
818 return(NULL);
819}
static ATTRIBUTE_NO_SANITIZE_INTEGER xmlHashEntry * xmlHashFindEntry(const xmlHashTable *hash, const xmlChar *key, const xmlChar *key2, const xmlChar *key3, unsigned hashValue, int *pfound)
Definition: hash.c:292
static ATTRIBUTE_NO_SANITIZE_INTEGER unsigned xmlHashValue(unsigned seed, const xmlChar *key, const xmlChar *key2, const xmlChar *key3, size_t *lengths)
Definition: hash.c:61

Referenced by xmlAddAttributeDecl(), xmlGetDtdAttrDesc(), xmlGetDtdQAttrDesc(), xmlHashLookup(), xmlHashLookup2(), xsltAddTemplate(), and xsltGetTemplate().

◆ xmlHashQLookup()

XMLPUBFUN void * xmlHashQLookup ( xmlHashTablePtr  hash,
const xmlChar prefix,
const xmlChar name 
)

Definition at line 770 of file hash.c.

771 {
773}
ATTRIBUTE_NO_SANITIZE_INTEGER void * xmlHashQLookup3(xmlHashTablePtr hash, const xmlChar *prefix, const xmlChar *name, const xmlChar *prefix2, const xmlChar *name2, const xmlChar *prefix3, const xmlChar *name3)
Definition: hash.c:837
Definition: name.c:39
Character const *const prefix
Definition: tempnam.cpp:195

◆ xmlHashQLookup2()

XMLPUBFUN void * xmlHashQLookup2 ( xmlHashTablePtr  hash,
const xmlChar prefix,
const xmlChar name,
const xmlChar prefix2,
const xmlChar name2 
)

Definition at line 788 of file hash.c.

790 {
791 return(xmlHashQLookup3(hash, prefix, name, prefix2, name2, NULL, NULL));
792}
static WCHAR name2[]
Definition: record.c:35

Referenced by xmlParseAttribute2().

◆ xmlHashQLookup3()

XMLPUBFUN void * xmlHashQLookup3 ( xmlHashTablePtr  hash,
const xmlChar prefix,
const xmlChar name,
const xmlChar prefix2,
const xmlChar name2,
const xmlChar prefix3,
const xmlChar name3 
)

Definition at line 837 of file hash.c.

840 {
841 const xmlHashEntry *entry;
842 unsigned hashValue, mask, pos, displ;
843
844 if ((hash == NULL) || (hash->size == 0) || (name == NULL))
845 return(NULL);
846
847 hashValue = xmlHashQNameValue(hash->randomSeed, prefix, name, prefix2,
848 name2, prefix3, name3);
849 mask = hash->size - 1;
850 pos = hashValue & mask;
851 entry = &hash->table[pos];
852
853 if (entry->hashValue != 0) {
854 displ = 0;
855 hashValue |= MAX_HASH_SIZE;
856
857 do {
858 if ((hashValue == entry->hashValue) &&
859 (xmlStrQEqual(prefix, name, entry->key)) &&
860 (xmlStrQEqual(prefix2, name2, entry->key2)) &&
861 (xmlStrQEqual(prefix3, name3, entry->key3)))
862 return(entry->payload);
863
864 displ++;
865 pos++;
866 entry++;
867 if ((pos & mask) == 0)
868 entry = hash->table;
869 } while ((entry->hashValue != 0) &&
870 (((pos - entry->hashValue) & mask) >= displ));
871 }
872
873 return(NULL);
874}
static const WCHAR name3[]
Definition: db.c:2839
GLenum GLint GLuint mask
Definition: glext.h:6028
static ATTRIBUTE_NO_SANITIZE_INTEGER unsigned xmlHashQNameValue(unsigned seed, const xmlChar *prefix, const xmlChar *name, const xmlChar *prefix2, const xmlChar *name2, const xmlChar *prefix3, const xmlChar *name3)
Definition: hash.c:101
XMLPUBFUN int xmlStrQEqual(const xmlChar *pref, const xmlChar *name, const xmlChar *str)
Definition: xmlstring.c:188

Referenced by xmlHashQLookup(), and xmlHashQLookup2().

◆ xmlHashRemoveEntry()

XMLPUBFUN int xmlHashRemoveEntry ( xmlHashTablePtr  hash,
const xmlChar key,
xmlHashDeallocator  dealloc 
)

xmlHashRemoveEntry: @hash: hash table @key: string key @dealloc: deallocator function for removed item or NULL

Find the entry specified by the @key and remove it from the hash table. Payload will be freed with @dealloc.

Returns 0 on success and -1 if no entry was found.

Definition at line 1102 of file hash.c.

1103 {
1105}
ATTRIBUTE_NO_SANITIZE_INTEGER int xmlHashRemoveEntry3(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, const xmlChar *key3, xmlHashDeallocator dealloc)
Definition: hash.c:1142

Referenced by cache_add_entry(), cache_remove_entry(), xmlRemoveID(), and xsltUnregisterExtModule().

◆ xmlHashRemoveEntry2()

XMLPUBFUN int xmlHashRemoveEntry2 ( xmlHashTablePtr  hash,
const xmlChar key,
const xmlChar key2,
xmlHashDeallocator  dealloc 
)

xmlHashRemoveEntry2: @hash: hash table @key: first string key @key2: second string key @dealloc: deallocator function for removed item or NULL

Remove an entry with two strings as key.

See xmlHashRemoveEntry.

Returns 0 on success and -1 in case of error.

Definition at line 1121 of file hash.c.

1122 {
1123 return(xmlHashRemoveEntry3(hash, key, key2, NULL, dealloc));
1124}

Referenced by xmlAddElementDecl(), xmlCleanSpecialAttrCallback(), xsltResolveAttrSet(), xsltUnregisterExtModuleElement(), xsltUnregisterExtModuleFunction(), and xsltUnregisterExtModuleTopLevel().

◆ xmlHashRemoveEntry3()

XMLPUBFUN int xmlHashRemoveEntry3 ( xmlHashTablePtr  hash,
const xmlChar key,
const xmlChar key2,
const xmlChar key3,
xmlHashDeallocator  dealloc 
)

xmlHashRemoveEntry3: @hash: hash table @key: first string key @key2: second string key @key3: third string key @dealloc: deallocator function for removed item or NULL

Remove an entry with three strings as key.

See xmlHashRemoveEntry.

Returns 0 on success and -1 in case of error.

Definition at line 1142 of file hash.c.

1144 {
1146 unsigned hashValue, mask, pos, nextpos;
1147 int found;
1148
1149 if ((hash == NULL) || (hash->size == 0) || (key == NULL))
1150 return(-1);
1151
1152 hashValue = xmlHashValue(hash->randomSeed, key, key2, key3, NULL);
1153 entry = xmlHashFindEntry(hash, key, key2, key3, hashValue, &found);
1154 if (!found)
1155 return(-1);
1156
1157 if ((dealloc != NULL) && (entry->payload != NULL))
1158 dealloc(entry->payload, entry->key);
1159 if (hash->dict == NULL) {
1160 if (entry->key)
1161 xmlFree(entry->key);
1162 if (entry->key2)
1163 xmlFree(entry->key2);
1164 if (entry->key3)
1165 xmlFree(entry->key3);
1166 }
1167
1168 /*
1169 * Find end of probe sequence. Entries at their initial probe
1170 * position start a new sequence.
1171 */
1172 mask = hash->size - 1;
1173 pos = entry - hash->table;
1174 cur = entry;
1175
1176 while (1) {
1177 nextpos = pos + 1;
1178 next = cur + 1;
1179 if ((nextpos & mask) == 0)
1180 next = hash->table;
1181
1182 if ((next->hashValue == 0) ||
1183 (((next->hashValue - nextpos) & mask) == 0))
1184 break;
1185
1186 cur = next;
1187 pos = nextpos;
1188 }
1189
1190 /*
1191 * Backward shift
1192 */
1193 next = entry + 1;
1194
1195 if (cur < entry) {
1196 xmlHashEntry *end = &hash->table[hash->size];
1197
1198 memmove(entry, next, (char *) end - (char *) next);
1199 entry = hash->table;
1200 end[-1] = *entry;
1201 next = entry + 1;
1202 }
1203
1204 memmove(entry, next, (char *) cur - (char *) entry);
1205
1206 /*
1207 * Update entry
1208 */
1209 cur->hashValue = 0;
1210
1211 hash->nbElems--;
1212
1213 return(0);
1214}
FxCollectionEntry * cur
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static unsigned __int64 next
Definition: rand_nt.c:6

Referenced by xmlHashRemoveEntry(), and xmlHashRemoveEntry2().

◆ xmlHashScan()

XMLPUBFUN void xmlHashScan ( xmlHashTablePtr  hash,
xmlHashScanner  scan,
void data 
)

xmlHashScan: @hash: hash table @scan: scanner function for items in the hash @data: extra data passed to @scan

Scan the hash @table and apply @scan to each value.

Definition at line 898 of file hash.c.

898 {
900 sdata.data = data;
901 sdata.scan = scan;
903}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static void stubHashScannerFull(void *payload, void *data, const xmlChar *key, const xmlChar *key2 ATTRIBUTE_UNUSED, const xmlChar *key3 ATTRIBUTE_UNUSED)
Definition: hash.c:882
void xmlHashScanFull(xmlHashTablePtr hash, xmlHashScannerFull scan, void *data)
Definition: hash.c:914
Definition: hash.c:876
static uint8 * sdata
Definition: svgawin.c:77

Referenced by schema_cache_addCollection(), xsltCleanupGlobals(), xsltEvalGlobalVariables(), xsltFixImportedCompSteps(), xsltInitCtxtExts(), xsltShutdownCtxtExts(), and xsltShutdownExts().

◆ xmlHashScan3()

XMLPUBFUN void xmlHashScan3 ( xmlHashTablePtr  hash,
const xmlChar key,
const xmlChar key2,
const xmlChar key3,
xmlHashScanner  scan,
void data 
)

xmlHashScan3: @hash: hash table @key: first string key or NULL @key2: second string key or NULL @key3: third string key or NULL @scan: scanner function for items in the hash @data: extra data passed to @scan

Scan the hash @table and apply @scan to each value matching (@key, @key2, @key3) tuple. If one of the keys is null, the comparison is considered to match.

Definition at line 969 of file hash.c.

971 {
973 sdata.data = data;
974 sdata.scan = scan;
976}
void xmlHashScanFull3(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, const xmlChar *key3, xmlHashScannerFull scan, void *data)
Definition: hash.c:992

◆ xmlHashScanFull()

XMLPUBFUN void xmlHashScanFull ( xmlHashTablePtr  hash,
xmlHashScannerFull  scan,
void data 
)

xmlHashScanFull: @hash: hash table @scan: scanner function for items in the hash @data: extra data passed to @scan

Scan the hash @table and apply @scan to each value.

Definition at line 914 of file hash.c.

914 {
915 const xmlHashEntry *entry, *end;
916 xmlHashEntry old;
917 unsigned i;
918
919 if ((hash == NULL) || (hash->size == 0) || (scan == NULL))
920 return;
921
922 /*
923 * We must handle the case that a scanned entry is removed when executing
924 * the callback (xmlCleanSpecialAttr and possibly other places).
925 *
926 * Find the start of a probe sequence to avoid scanning entries twice if
927 * a deletion happens.
928 */
929 entry = hash->table;
930 end = &hash->table[hash->size];
931 while (entry->hashValue != 0) {
932 if (++entry >= end)
933 entry = hash->table;
934 }
935
936 for (i = 0; i < hash->size; i++) {
937 if ((entry->hashValue != 0) && (entry->payload != NULL)) {
938 /*
939 * Make sure to rescan after a possible deletion.
940 */
941 do {
942 old = *entry;
943 scan(entry->payload, data, entry->key, entry->key2, entry->key3);
944 } while ((entry->hashValue != 0) &&
945 (entry->payload != NULL) &&
946 ((entry->key != old.key) ||
947 (entry->key2 != old.key2) ||
948 (entry->key3 != old.key3)));
949 }
950 if (++entry >= end)
951 entry = hash->table;
952 }
953}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
xmlChar * key
Definition: hash.c:39
xmlChar * key3
Definition: hash.c:41
xmlChar * key2
Definition: hash.c:40

Referenced by xmlCleanSpecialAttr(), xmlHashScan(), xsltDebugDumpExtensions(), and xsltResolveStylesheetAttributeSet().

◆ xmlHashScanFull3()

XMLPUBFUN void xmlHashScanFull3 ( xmlHashTablePtr  hash,
const xmlChar key,
const xmlChar key2,
const xmlChar key3,
xmlHashScannerFull  scan,
void data 
)

xmlHashScanFull3: @hash: hash table @key: first string key or NULL @key2: second string key or NULL @key3: third string key or NULL @scan: scanner function for items in the hash @data: extra data passed to @scan

Scan the hash @table and apply @scan to each value matching (@key, @key2, @key3) tuple. If one of the keys is null, the comparison is considered to match.

Definition at line 992 of file hash.c.

994 {
995 const xmlHashEntry *entry, *end;
996 xmlHashEntry old;
997 unsigned i;
998
999 if ((hash == NULL) || (hash->size == 0) || (scan == NULL))
1000 return;
1001
1002 /*
1003 * We must handle the case that a scanned entry is removed when executing
1004 * the callback (xmlCleanSpecialAttr and possibly other places).
1005 *
1006 * Find the start of a probe sequence to avoid scanning entries twice if
1007 * a deletion happens.
1008 */
1009 entry = hash->table;
1010 end = &hash->table[hash->size];
1011 while (entry->hashValue != 0) {
1012 if (++entry >= end)
1013 entry = hash->table;
1014 }
1015
1016 for (i = 0; i < hash->size; i++) {
1017 if ((entry->hashValue != 0) && (entry->payload != NULL)) {
1018 /*
1019 * Make sure to rescan after a possible deletion.
1020 */
1021 do {
1022 if (((key != NULL) && (strcmp((const char *) key,
1023 (const char *) entry->key) != 0)) ||
1024 ((key2 != NULL) && (!xmlFastStrEqual(key2, entry->key2))) ||
1025 ((key3 != NULL) && (!xmlFastStrEqual(key3, entry->key3))))
1026 break;
1027 old = *entry;
1028 scan(entry->payload, data, entry->key, entry->key2, entry->key3);
1029 } while ((entry->hashValue != 0) &&
1030 (entry->payload != NULL) &&
1031 ((entry->key != old.key) ||
1032 (entry->key2 != old.key2) ||
1033 (entry->key3 != old.key3)));
1034 }
1035 if (++entry >= end)
1036 entry = hash->table;
1037 }
1038}
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
static int xmlFastStrEqual(const xmlChar *s1, const xmlChar *s2)
Definition: hash.c:269

Referenced by xmlHashScan3().

◆ xmlHashSize()

XMLPUBFUN int xmlHashSize ( xmlHashTablePtr  hash)

xmlHashSize: @hash: hash table

Query the number of elements in the hash table.

Returns the number of elements in the hash table or -1 in case of error.

Definition at line 1085 of file hash.c.

1085 {
1086 if (hash == NULL)
1087 return(-1);
1088 return(hash->nbElems);
1089}

Referenced by lookup_schema_elemDecl(), and xmlCleanSpecialAttr().

◆ xmlHashUpdateEntry()

XMLPUBFUN int xmlHashUpdateEntry ( xmlHashTablePtr  hash,
const xmlChar key,
void payload,
xmlHashDeallocator  dealloc 
)

xmlHashUpdateEntry: @hash: hash table @key: string key @payload: pointer to the payload @dealloc: deallocator function for replaced item or NULL

Add a hash table entry. If an entry with this key already exists, the old payload will be freed and updated with the new value.

Returns 0 in case of success, -1 if a memory allocation failed.

Definition at line 678 of file hash.c.

679 {
680 return(xmlHashUpdateInternal(hash, key, NULL, NULL, payload,
681 dealloc, 1));
682}

Referenced by xmlRemoveRef(), and xsltGatherNamespaces().

◆ xmlHashUpdateEntry2()

XMLPUBFUN int xmlHashUpdateEntry2 ( xmlHashTablePtr  hash,
const xmlChar key,
const xmlChar key2,
void payload,
xmlHashDeallocator  dealloc 
)

xmlHashUpdateEntry2: @hash: hash table @key: first string key @key2: second string key @payload: pointer to the payload @dealloc: deallocator function for replaced item or NULL

Add a hash table entry with two strings as key.

See xmlHashUpdateEntry.

Returns 0 on success and -1 in case of error.

Definition at line 699 of file hash.c.

701 {
702 return(xmlHashUpdateInternal(hash, key, key2, NULL, payload,
703 dealloc, 1));
704}

Referenced by xmlAddDefAttrs(), xsltRegisterExtModuleElement(), xsltRegisterExtModuleFunction(), and xsltRegisterExtModuleTopLevel().

◆ xmlHashUpdateEntry3()

XMLPUBFUN int xmlHashUpdateEntry3 ( xmlHashTablePtr  hash,
const xmlChar key,
const xmlChar key2,
const xmlChar key3,
void payload,
xmlHashDeallocator  dealloc 
)

xmlHashUpdateEntry3: @hash: hash table @key: first string key @key2: second string key @key3: third string key @payload: pointer to the payload @dealloc: deallocator function for replaced item or NULL

Add a hash table entry with three strings as key.

See xmlHashUpdateEntry.

Returns 0 on success and -1 in case of error.

Definition at line 722 of file hash.c.

724 {
725 return(xmlHashUpdateInternal(hash, key, key2, key3, payload,
726 dealloc, 1));
727}

Referenced by xsltAddTemplate().