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

Go to the source code of this file.

Classes

struct  xmlHashedString
 

Macros

#define HASH_ROL(x, n)   ((x) << (n) | ((x) & 0xFFFFFFFF) >> (32 - (n)))
 
#define HASH_ROR(x, n)   (((x) & 0xFFFFFFFF) >> (n) | (x) << (32 - (n)))
 
#define HASH_INIT(h1, h2, seed)
 
#define HASH_UPDATE(h1, h2, ch)
 
#define HASH_FINISH(h1, h2)
 

Functions

XML_HIDDEN void xmlInitDictInternal (void)
 
XML_HIDDEN void xmlCleanupDictInternal (void)
 
XML_HIDDEN unsigned xmlDictComputeHash (const xmlDict *dict, const xmlChar *string)
 
XML_HIDDEN unsigned xmlDictCombineHash (unsigned v1, unsigned v2)
 
XML_HIDDEN xmlHashedString xmlDictLookupHashed (xmlDictPtr dict, const xmlChar *name, int len)
 
XML_HIDDEN void xmlInitRandom (void)
 
XML_HIDDEN void xmlCleanupRandom (void)
 
XML_HIDDEN unsigned xmlRandom (void)
 

Macro Definition Documentation

◆ HASH_FINISH

#define HASH_FINISH (   h1,
  h2 
)
Value:
do { \
h1 ^= h2; \
h1 += HASH_ROL(h2, 14); \
h2 ^= h1; h2 += HASH_ROR(h1, 6); \
h1 ^= h2; h1 += HASH_ROL(h2, 5); \
h2 ^= h1; h2 += HASH_ROR(h1, 8); \
h2 &= 0xFFFFFFFF; \
} while (0)
#define HASH_ROR(x, n)
Definition: dict.h:13
#define HASH_ROL(x, n)
Definition: dict.h:12

Definition at line 38 of file dict.h.

◆ HASH_INIT

#define HASH_INIT (   h1,
  h2,
  seed 
)
Value:
do { \
h1 = seed ^ 0x3b00; \
h2 = HASH_ROL(seed, 15); \
} while (0)

Definition at line 22 of file dict.h.

◆ HASH_ROL

#define HASH_ROL (   x,
  n 
)    ((x) << (n) | ((x) & 0xFFFFFFFF) >> (32 - (n)))

Definition at line 12 of file dict.h.

◆ HASH_ROR

#define HASH_ROR (   x,
  n 
)    (((x) & 0xFFFFFFFF) >> (n) | (x) << (32 - (n)))

Definition at line 13 of file dict.h.

◆ HASH_UPDATE

#define HASH_UPDATE (   h1,
  h2,
  ch 
)
Value:
do { \
h1 += ch; \
h1 += h1 << 3; \
h2 += h1; \
h2 = HASH_ROL(h2, 7); \
h2 += h2 << 2; \
} while (0)
unsigned char ch[4][2]
Definition: console.c:118

Definition at line 28 of file dict.h.

Function Documentation

◆ xmlCleanupDictInternal()

XML_HIDDEN void xmlCleanupDictInternal ( void  )

xmlCleanupDictInternal:

Free the dictionary mutex.

Definition at line 121 of file dict.c.

121 {
123}
XML_HIDDEN void xmlCleanupMutex(xmlMutexPtr mutex)
Definition: threads.c:166
static xmlMutex xmlDictMutex
Definition: dict.c:78

Referenced by xmlCleanupParser().

◆ xmlCleanupRandom()

XML_HIDDEN void xmlCleanupRandom ( void  )

Definition at line 932 of file dict.c.

932 {
934}
static xmlMutex xmlRngMutex
Definition: dict.c:907

Referenced by xmlCleanupParser().

◆ xmlDictCombineHash()

XML_HIDDEN unsigned xmlDictCombineHash ( unsigned  v1,
unsigned  v2 
)

Definition at line 521 of file dict.c.

521 {
522 /*
523 * The upper bit of hash values is always set, so we have to operate on
524 * 31-bit hashes here.
525 */
526 v1 ^= v2;
527 v1 += HASH_ROL31(v2, 5);
528
529 return((v1 & 0xFFFFFFFF) | 0x80000000);
530}
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
#define HASH_ROL31(x, n)
Definition: dict.c:517

Referenced by xmlParseStartTag2().

◆ xmlDictComputeHash()

XML_HIDDEN unsigned xmlDictComputeHash ( const xmlDict dict,
const xmlChar string 
)

Definition at line 512 of file dict.c.

512 {
513 size_t len;
514 return(xmlDictHashName(dict->seed, string, SIZE_MAX, &len));
515}
GLenum GLsizei len
Definition: glext.h:6722
#define SIZE_MAX
Definition: dict.c:35
static ATTRIBUTE_NO_SANITIZE_INTEGER unsigned xmlDictHashName(unsigned seed, const xmlChar *data, size_t maxLen, size_t *plen)
Definition: dict.c:464
unsigned seed
Definition: dict.c:69

Referenced by xmlParserNsLookupSax(), and xmlParserNsUpdateSax().

◆ xmlDictLookupHashed()

XML_HIDDEN xmlHashedString xmlDictLookupHashed ( xmlDictPtr  dict,
const xmlChar name,
int  len 
)

Definition at line 845 of file dict.c.

845 {
846 const xmlDictEntry *entry;
848
850
851 if (entry == NULL) {
852 ret.name = NULL;
853 ret.hashValue = 0;
854 } else {
855 ret = *entry;
856 }
857
858 return(ret);
859}
#define NULL
Definition: types.h:112
return ret
Definition: mutex.c:146
uint32_t entry
Definition: isohybrid.c:63
static ATTRIBUTE_NO_SANITIZE_INTEGER const xmlDictEntry * xmlDictLookupInternal(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name, int maybeLen, int update)
Definition: dict.c:678
Definition: name.c:39

Referenced by xmlAddDefAttrs(), xmlParseInNodeContext(), xmlParseNCName(), xmlParseNCNameComplex(), xmlParseQNameHashed(), and xmlParseStartTag2().

◆ xmlInitDictInternal()

XML_HIDDEN void xmlInitDictInternal ( void  )

xmlInitDictInternal:

Initialize mutex.

Definition at line 99 of file dict.c.

99 {
101}
XML_HIDDEN void xmlInitMutex(xmlMutexPtr mutex)
Definition: threads.c:128

Referenced by xmlInitParser().

◆ xmlInitRandom()

XML_HIDDEN void xmlInitRandom ( void  )

Definition at line 918 of file dict.c.

918 {
919 int var;
920
922
923 /* TODO: Get seed values from system PRNG */
924
926 HASH_ROL((unsigned) (size_t) &xmlInitRandom, 8);
927 globalRngState[1] = HASH_ROL((unsigned) (size_t) &xmlRngMutex, 16) ^
928 HASH_ROL((unsigned) (size_t) &var, 24);
929}
__u16 time
Definition: mkdosfs.c:8
const char * var
Definition: shader.c:5666
static unsigned(__cdecl *hash_bstr)(bstr_t s)
ATTRIBUTE_NO_SANITIZE_INTEGER void xmlInitRandom(void)
Definition: dict.c:918
static unsigned globalRngState[2]
Definition: dict.c:909

Referenced by xmlInitParser(), and xmlInitRandom().

◆ xmlRandom()

XML_HIDDEN unsigned xmlRandom ( void  )

Definition at line 951 of file dict.c.

951 {
952#ifdef XML_THREAD_LOCAL
953 if (!localRngInitialized) {
955 localRngState[0] = xoroshiro64ss(globalRngState);
956 localRngState[1] = xoroshiro64ss(globalRngState);
957 localRngInitialized = 1;
959 }
960
961 return(xoroshiro64ss(localRngState));
962#else
963 unsigned ret;
964
968
969 return(ret);
970#endif
971}
XMLPUBFUN void xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:201
XMLPUBFUN void xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:225
static ATTRIBUTE_NO_SANITIZE_INTEGER unsigned xoroshiro64ss(unsigned *s)
Definition: dict.c:938

Referenced by xmlDictCreate(), and xmlHashCreate().