ReactOS  0.4.14-dev-50-g13bb5e2
hash.c File Reference
#include "libxml.h"
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <libxml/parser.h>
#include <libxml/hash.h>
#include <libxml/xmlmemory.h>
#include <libxml/xmlerror.h>
#include <libxml/globals.h>
#include "elfgcchack.h"
Include dependency graph for hash.c:

Go to the source code of this file.

Classes

struct  _xmlHashEntry
 
struct  _xmlHashTable
 
struct  stubData
 

Macros

#define IN_LIBXML
 
#define HASH_RANDOMIZATION
 
#define MAX_HASH_LEN   8
 

Typedefs

typedef struct _xmlHashEntry xmlHashEntry
 
typedef xmlHashEntryxmlHashEntryPtr
 

Functions

static unsigned long xmlHashComputeKey (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
 
static unsigned long xmlHashComputeQKey (xmlHashTablePtr table, const xmlChar *prefix, const xmlChar *name, const xmlChar *prefix2, const xmlChar *name2, const xmlChar *prefix3, const xmlChar *name3)
 
xmlHashTablePtr xmlHashCreate (int size)
 
xmlHashTablePtr xmlHashCreateDict (int size, xmlDictPtr dict)
 
static int xmlHashGrow (xmlHashTablePtr table, int size)
 
void xmlHashFree (xmlHashTablePtr table, xmlHashDeallocator f)
 
: the entry's name

xmlHashDefaultDeallocator: @entry: the hash table entry

Free a hash table entry with xmlFree.

void xmlHashDefaultDeallocator (void *entry, const xmlChar *name ATTRIBUTE_UNUSED)
 
. Duplicate names generate errors.

Returns 0 the addition succeeded and -1 in case of error.

int xmlHashAddEntry (xmlHashTablePtr table, const xmlChar *name, void *userdata)
 
, @name2) tuple. Duplicate tuples generate errors.

Returns 0 the addition succeeded and -1 in case of error.

int xmlHashAddEntry2 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata)
 
. Existing entry for this @name will be removed

and freed with @f if found.

Returns 0 the addition succeeded and -1 in case of error.

int xmlHashUpdateEntry (xmlHashTablePtr table, const xmlChar *name, void *userdata, xmlHashDeallocator f)
 
, @name2) tuple. Existing entry for this tuple will

be removed and freed with @f if found.

Returns 0 the addition succeeded and -1 in case of error.

int xmlHashUpdateEntry2 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata, xmlHashDeallocator f)
 
.

Returns the pointer to the userdata

voidxmlHashLookup (xmlHashTablePtr table, const xmlChar *name)
 
, @name2) tuple.

Returns the pointer to the userdata

voidxmlHashLookup2 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
 
/@name.

Returns the pointer to the userdata

voidxmlHashQLookup (xmlHashTablePtr table, const xmlChar *prefix, const xmlChar *name)
 
2: a second name of the userdata
voidxmlHashQLookup2 (xmlHashTablePtr table, const xmlChar *prefix, const xmlChar *name, const xmlChar *prefix2, const xmlChar *name2)
 
, @name2, @name3). Duplicate entries generate

errors.

Returns 0 the addition succeeded and -1 in case of error.

int xmlHashAddEntry3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata)
 
, @name2, @name3). Existing entry for this tuple

will be removed and freed with @f if found.

Returns 0 the addition succeeded and -1 in case of error.

int xmlHashUpdateEntry3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata, xmlHashDeallocator f)
 
, @name2, @name3) tuple.

Returns the a pointer to the userdata

voidxmlHashLookup3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
 
voidxmlHashQLookup3 (xmlHashTablePtr table, const xmlChar *prefix, const xmlChar *name, const xmlChar *prefix2, const xmlChar *name2, const xmlChar *prefix3, const xmlChar *name3)
 
static void stubHashScannerFull (void *payload, void *data, const xmlChar *name, const xmlChar *name2 ATTRIBUTE_UNUSED, const xmlChar *name3 ATTRIBUTE_UNUSED)
 
void xmlHashScan (xmlHashTablePtr table, xmlHashScanner f, void *data)
 
void xmlHashScanFull (xmlHashTablePtr table, xmlHashScannerFull f, void *data)
 
, @name2, @name3) tuple. If one of the names is null,

the comparison is considered to match.

void xmlHashScan3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashScanner f, void *data)
 
void xmlHashScanFull3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashScannerFull f, void *data)
 
xmlHashTablePtr xmlHashCopy (xmlHashTablePtr table, xmlHashCopier f)
 
int xmlHashSize (xmlHashTablePtr table)
 
and remove

it from the hash @table. Existing userdata for this tuple will be removed and freed with @f.

Returns 0 if the removal succeeded and -1 in case of error or not found.

int xmlHashRemoveEntry (xmlHashTablePtr table, const xmlChar *name, xmlHashDeallocator f)
 
, @name2) tuple and remove

it from the hash @table. Existing userdata for this tuple will be removed and freed with @f.

Returns 0 if the removal succeeded and -1 in case of error or not found.

int xmlHashRemoveEntry2 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, xmlHashDeallocator f)
 

, @name2, @name3) tuple and remove

it from the hash @table. Existing userdata for this tuple will be removed and freed with @f.

Returns 0 if the removal succeeded and -1 in case of error or not found.

#define bottom_hash
 
int xmlHashRemoveEntry3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashDeallocator f)
 

Macro Definition Documentation

◆ bottom_hash

#define bottom_hash

Definition at line 1138 of file hash.c.

◆ HASH_RANDOMIZATION

#define HASH_RANDOMIZATION

Definition at line 37 of file hash.c.

◆ IN_LIBXML

#define IN_LIBXML

Definition at line 20 of file hash.c.

◆ MAX_HASH_LEN

#define MAX_HASH_LEN   8

Definition at line 46 of file hash.c.

Typedef Documentation

◆ xmlHashEntry

Definition at line 53 of file hash.c.

◆ xmlHashEntryPtr

Definition at line 54 of file hash.c.

Function Documentation

◆ stubHashScannerFull()

static void stubHashScannerFull ( void payload,
void data,
const xmlChar name,
const xmlChar *name2  ATTRIBUTE_UNUSED,
const xmlChar *name3  ATTRIBUTE_UNUSED 
)
static

Definition at line 841 of file hash.c.

843  {
844  stubData *stubdata = (stubData *) data;
845  stubdata->hashscanner (payload, stubdata->data, (xmlChar *) name);
846 }
xmlHashScanner hashscanner
Definition: hash.c:836
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void * data
Definition: hash.c:837
unsigned char xmlChar
Definition: xmlstring.h:28
Definition: name.c:36
Definition: hash.c:835

Referenced by xmlHashScan(), and xmlHashScan3().

◆ xmlHashAddEntry()

int xmlHashAddEntry ( xmlHashTablePtr  table,
const xmlChar name,
void userdata 
)

Definition at line 387 of file hash.c.

387  {
388  return(xmlHashAddEntry3(table, name, NULL, NULL, userdata));
389 }
smooth NULL
Definition: ftsmooth.c:416
int xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata)
Definition: hash.c:529
Definition: name.c:36

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

◆ xmlHashAddEntry2()

int xmlHashAddEntry2 ( xmlHashTablePtr  table,
const xmlChar name,
const xmlChar name2,
void userdata 
)

Definition at line 404 of file hash.c.

405  {
406  return(xmlHashAddEntry3(table, name, name2, NULL, userdata));
407 }
smooth NULL
Definition: ftsmooth.c:416
int xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata)
Definition: hash.c:529
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35

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

◆ xmlHashAddEntry3()

int xmlHashAddEntry3 ( xmlHashTablePtr  table,
const xmlChar name,
const xmlChar name2,
const xmlChar name3,
void userdata 
)

Definition at line 529 of file hash.c.

531  {
532  unsigned long key, len = 0;
535 
536  if ((table == NULL) || (name == NULL))
537  return(-1);
538 
539  /*
540  * If using a dict internalize if needed
541  */
542  if (table->dict) {
543  if (!xmlDictOwns(table->dict, name)) {
544  name = xmlDictLookup(table->dict, name, -1);
545  if (name == NULL)
546  return(-1);
547  }
548  if ((name2 != NULL) && (!xmlDictOwns(table->dict, name2))) {
549  name2 = xmlDictLookup(table->dict, name2, -1);
550  if (name2 == NULL)
551  return(-1);
552  }
553  if ((name3 != NULL) && (!xmlDictOwns(table->dict, name3))) {
554  name3 = xmlDictLookup(table->dict, name3, -1);
555  if (name3 == NULL)
556  return(-1);
557  }
558  }
559 
560  /*
561  * Check for duplicate and insertion location.
562  */
564  if (table->table[key].valid == 0) {
565  insert = NULL;
566  } else {
567  if (table->dict) {
568  for (insert = &(table->table[key]); insert->next != NULL;
569  insert = insert->next) {
570  if ((insert->name == name) &&
571  (insert->name2 == name2) &&
572  (insert->name3 == name3))
573  return(-1);
574  len++;
575  }
576  if ((insert->name == name) &&
577  (insert->name2 == name2) &&
578  (insert->name3 == name3))
579  return(-1);
580  } else {
581  for (insert = &(table->table[key]); insert->next != NULL;
582  insert = insert->next) {
583  if ((xmlStrEqual(insert->name, name)) &&
584  (xmlStrEqual(insert->name2, name2)) &&
585  (xmlStrEqual(insert->name3, name3)))
586  return(-1);
587  len++;
588  }
589  if ((xmlStrEqual(insert->name, name)) &&
590  (xmlStrEqual(insert->name2, name2)) &&
591  (xmlStrEqual(insert->name3, name3)))
592  return(-1);
593  }
594  }
595 
596  if (insert == NULL) {
597  entry = &(table->table[key]);
598  } else {
599  entry = xmlMalloc(sizeof(xmlHashEntry));
600  if (entry == NULL)
601  return(-1);
602  }
603 
604  if (table->dict != NULL) {
605  entry->name = (xmlChar *) name;
606  entry->name2 = (xmlChar *) name2;
607  entry->name3 = (xmlChar *) name3;
608  } else {
609  entry->name = xmlStrdup(name);
610  entry->name2 = xmlStrdup(name2);
611  entry->name3 = xmlStrdup(name3);
612  }
613  entry->payload = userdata;
614  entry->next = NULL;
615  entry->valid = 1;
616 
617 
618  if (insert != NULL)
619  insert->next = entry;
620 
621  table->nbElems++;
622 
623  if (len > MAX_HASH_LEN)
625 
626  return(0);
627 }
static int insert
Definition: xmllint.c:144
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:858
#define MAX_HASH_LEN
Definition: hash.c:46
HKEY key
Definition: reg.c:42
uint32_t entry
Definition: isohybrid.c:63
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
static int xmlHashGrow(xmlHashTablePtr table, int size)
Definition: hash.c:229
XMLPUBFUN int XMLCALL xmlDictOwns(xmlDictPtr dict, const xmlChar *str)
Definition: dict.c:1211
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
static const WCHAR name3[]
Definition: db.c:2958
static unsigned long xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
Definition: hash.c:82
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
Definition: path.c:42

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

◆ xmlHashComputeKey()

static unsigned long xmlHashComputeKey ( xmlHashTablePtr  table,
const xmlChar name,
const xmlChar name2,
const xmlChar name3 
)
static

Definition at line 82 of file hash.c.

83  {
84  unsigned long value = 0L;
85  char ch;
86 
87 #ifdef HASH_RANDOMIZATION
88  value = table->random_seed;
89 #endif
90  if (name != NULL) {
91  value += 30 * (*name);
92  while ((ch = *name++) != 0) {
93  value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
94  }
95  }
96  value = value ^ ((value << 5) + (value >> 3));
97  if (name2 != NULL) {
98  while ((ch = *name2++) != 0) {
99  value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
100  }
101  }
102  value = value ^ ((value << 5) + (value >> 3));
103  if (name3 != NULL) {
104  while ((ch = *name3++) != 0) {
105  value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
106  }
107  }
108  return (value % table->size);
109 }
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1250
#define long
Definition: qsort.c:33
static const WCHAR name3[]
Definition: db.c:2958
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35

Referenced by xmlHashAddEntry3(), xmlHashGrow(), xmlHashLookup3(), xmlHashRemoveEntry3(), and xmlHashUpdateEntry3().

◆ xmlHashComputeQKey()

static unsigned long xmlHashComputeQKey ( xmlHashTablePtr  table,
const xmlChar prefix,
const xmlChar name,
const xmlChar prefix2,
const xmlChar name2,
const xmlChar prefix3,
const xmlChar name3 
)
static

Definition at line 112 of file hash.c.

115  {
116  unsigned long value = 0L;
117  char ch;
118 
119 #ifdef HASH_RANDOMIZATION
120  value = table->random_seed;
121 #endif
122  if (prefix != NULL)
123  value += 30 * (*prefix);
124  else
125  value += 30 * (*name);
126 
127  if (prefix != NULL) {
128  while ((ch = *prefix++) != 0) {
129  value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
130  }
131  value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
132  }
133  if (name != NULL) {
134  while ((ch = *name++) != 0) {
135  value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
136  }
137  }
138  value = value ^ ((value << 5) + (value >> 3));
139  if (prefix2 != NULL) {
140  while ((ch = *prefix2++) != 0) {
141  value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
142  }
143  value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
144  }
145  if (name2 != NULL) {
146  while ((ch = *name2++) != 0) {
147  value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
148  }
149  }
150  value = value ^ ((value << 5) + (value >> 3));
151  if (prefix3 != NULL) {
152  while ((ch = *prefix3++) != 0) {
153  value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
154  }
155  value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
156  }
157  if (name3 != NULL) {
158  while ((ch = *name3++) != 0) {
159  value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
160  }
161  }
162  return (value % table->size);
163 }
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1250
#define long
Definition: qsort.c:33
static const WCHAR name3[]
Definition: db.c:2958
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35

Referenced by xmlHashQLookup3().

◆ xmlHashCopy()

xmlHashTablePtr xmlHashCopy ( xmlHashTablePtr  table,
xmlHashCopier  f 
)

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

Scan the hash @table and applied @f to each value.

Returns the new table or NULL in case of error.

Definition at line 990 of file hash.c.

990  {
991  int i;
992  xmlHashEntryPtr iter;
995 
996  if (table == NULL)
997  return(NULL);
998  if (f == NULL)
999  return(NULL);
1000 
1001  ret = xmlHashCreate(table->size);
1002  if (ret == NULL)
1003  return(NULL);
1004 
1005  if (table->table) {
1006  for(i = 0; i < table->size; i++) {
1007  if (table->table[i].valid == 0)
1008  continue;
1009  iter = &(table->table[i]);
1010  while (iter) {
1011  next = iter->next;
1012  xmlHashAddEntry3(ret, iter->name, iter->name2,
1013  iter->name3, f(iter->payload, iter->name));
1014  iter = next;
1015  }
1016  }
1017  }
1018  ret->nbElems = table->nbElems;
1019  return(ret);
1020 }
struct _xmlHashEntry * next
Definition: hash.c:56
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
void * payload
Definition: hash.c:60
smooth NULL
Definition: ftsmooth.c:416
xmlChar * name
Definition: hash.c:57
GLfloat f
Definition: glext.h:7540
int ret
xmlHashTablePtr xmlHashCreate(int size)
Definition: hash.c:174
int xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata)
Definition: hash.c:529
static unsigned __int64 next
Definition: rand_nt.c:6
xmlChar * name3
Definition: hash.c:59
xmlChar * name2
Definition: hash.c:58

◆ xmlHashCreate()

xmlHashTablePtr xmlHashCreate ( int  size)

xmlHashCreate: @size: the size of the hash table

Create a new xmlHashTablePtr.

Returns the newly created object, or NULL if an error occurred.

Definition at line 174 of file hash.c.

174  {
176 
177  if (size <= 0)
178  size = 256;
179 
180  table = xmlMalloc(sizeof(xmlHashTable));
181  if (table) {
182  table->dict = NULL;
183  table->size = size;
184  table->nbElems = 0;
185  table->table = xmlMalloc(size * sizeof(xmlHashEntry));
186  if (table->table) {
187  memset(table->table, 0, size * sizeof(xmlHashEntry));
188 #ifdef HASH_RANDOMIZATION
189  table->random_seed = __xmlRandom();
190 #endif
191  return(table);
192  }
193  xmlFree(table);
194  }
195  return(NULL);
196 }
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
int __xmlRandom(void)
Definition: dict.c:197
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
#define memset(x, y, z)
Definition: compat.h:39

Referenced by 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()

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 xmlHashTablePtr which will use @dict as the internal dictionary

Returns the newly created object, or NULL if an error occurred.

Definition at line 208 of file hash.c.

208  {
210 
212  if (table != NULL) {
213  table->dict = dict;
214  xmlDictReference(dict);
215  }
216  return(table);
217 }
XMLPUBFUN int XMLCALL xmlDictReference(xmlDictPtr dict)
Definition: dict.c:638
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
xmlHashTablePtr xmlHashCreate(int size)
Definition: hash.c:174

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

◆ xmlHashDefaultDeallocator()

void xmlHashDefaultDeallocator ( void entry,
const xmlChar *name  ATTRIBUTE_UNUSED 
)

Definition at line 371 of file hash.c.

371  {
372  xmlFree(entry);
373 }
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
uint32_t entry
Definition: isohybrid.c:63

◆ xmlHashFree()

void xmlHashFree ( xmlHashTablePtr  table,
xmlHashDeallocator  f 
)

xmlHashFree: @table: the hash table @f: the deallocator function for items in the hash

Free the hash @table and its contents. The userdata is deallocated with @f if provided.

Definition at line 320 of file hash.c.

320  {
321  int i;
322  xmlHashEntryPtr iter;
324  int inside_table = 0;
325  int nbElems;
326 
327  if (table == NULL)
328  return;
329  if (table->table) {
330  nbElems = table->nbElems;
331  for(i = 0; (i < table->size) && (nbElems > 0); i++) {
332  iter = &(table->table[i]);
333  if (iter->valid == 0)
334  continue;
335  inside_table = 1;
336  while (iter) {
337  next = iter->next;
338  if ((f != NULL) && (iter->payload != NULL))
339  f(iter->payload, iter->name);
340  if (table->dict == NULL) {
341  if (iter->name)
342  xmlFree(iter->name);
343  if (iter->name2)
344  xmlFree(iter->name2);
345  if (iter->name3)
346  xmlFree(iter->name3);
347  }
348  iter->payload = NULL;
349  if (!inside_table)
350  xmlFree(iter);
351  nbElems--;
352  inside_table = 0;
353  iter = next;
354  }
355  }
356  xmlFree(table->table);
357  }
358  if (table->dict)
359  xmlDictFree(table->dict);
360  xmlFree(table);
361 }
struct _xmlHashEntry * next
Definition: hash.c:56
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
void * payload
Definition: hash.c:60
smooth NULL
Definition: ftsmooth.c:416
xmlChar * name
Definition: hash.c:57
int valid
Definition: hash.c:61
GLfloat f
Definition: glext.h:7540
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN void XMLCALL xmlDictFree(xmlDictPtr dict)
Definition: dict.c:793
static unsigned __int64 next
Definition: rand_nt.c:6
xmlChar * name3
Definition: hash.c:59
#define f
Definition: ke_i.h:83
xmlChar * name2
Definition: hash.c:58

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

◆ xmlHashGrow()

static int xmlHashGrow ( xmlHashTablePtr  table,
int  size 
)
static

xmlHashGrow: @table: the hash table @size: the new size of the hash table

resize the hash table

Returns 0 in case of success, -1 in case of failure

Definition at line 229 of file hash.c.

229  {
230  unsigned long key;
231  int oldsize, i;
232  xmlHashEntryPtr iter, next;
233  struct _xmlHashEntry *oldtable;
234 #ifdef DEBUG_GROW
235  unsigned long nbElem = 0;
236 #endif
237 
238  if (table == NULL)
239  return(-1);
240  if (size < 8)
241  return(-1);
242  if (size > 8 * 2048)
243  return(-1);
244 
245  oldsize = table->size;
246  oldtable = table->table;
247  if (oldtable == NULL)
248  return(-1);
249 
250  table->table = xmlMalloc(size * sizeof(xmlHashEntry));
251  if (table->table == NULL) {
252  table->table = oldtable;
253  return(-1);
254  }
255  memset(table->table, 0, size * sizeof(xmlHashEntry));
256  table->size = size;
257 
258  /* If the two loops are merged, there would be situations where
259  a new entry needs to allocated and data copied into it from
260  the main table. So instead, we run through the array twice, first
261  copying all the elements in the main array (where we can't get
262  conflicts) and then the rest, so we only free (and don't allocate)
263  */
264  for (i = 0; i < oldsize; i++) {
265  if (oldtable[i].valid == 0)
266  continue;
267  key = xmlHashComputeKey(table, oldtable[i].name, oldtable[i].name2,
268  oldtable[i].name3);
269  memcpy(&(table->table[key]), &(oldtable[i]), sizeof(xmlHashEntry));
270  table->table[key].next = NULL;
271  }
272 
273  for (i = 0; i < oldsize; i++) {
274  iter = oldtable[i].next;
275  while (iter) {
276  next = iter->next;
277 
278  /*
279  * put back the entry in the new table
280  */
281 
282  key = xmlHashComputeKey(table, iter->name, iter->name2,
283  iter->name3);
284  if (table->table[key].valid == 0) {
285  memcpy(&(table->table[key]), iter, sizeof(xmlHashEntry));
286  table->table[key].next = NULL;
287  xmlFree(iter);
288  } else {
289  iter->next = table->table[key].next;
290  table->table[key].next = iter;
291  }
292 
293 #ifdef DEBUG_GROW
294  nbElem++;
295 #endif
296 
297  iter = next;
298  }
299  }
300 
301  xmlFree(oldtable);
302 
303 #ifdef DEBUG_GROW
305  "xmlHashGrow : from %d to %d, %d elems\n", oldsize, size, nbElem);
306 #endif
307 
308  return(0);
309 }
struct _xmlHashEntry * next
Definition: hash.c:56
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
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
smooth NULL
Definition: ftsmooth.c:416
xmlChar * name
Definition: hash.c:57
int valid
Definition: hash.c:61
GLsizeiptr size
Definition: glext.h:5919
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
HKEY key
Definition: reg.c:42
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static unsigned __int64 next
Definition: rand_nt.c:6
xmlChar * name3
Definition: hash.c:59
xmlChar * name2
Definition: hash.c:58
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
static const WCHAR name3[]
Definition: db.c:2958
static unsigned long xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
Definition: hash.c:82
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35
#define memset(x, y, z)
Definition: compat.h:39
Definition: path.c:42
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlHashAddEntry3().

◆ xmlHashLookup()

◆ xmlHashLookup2()

◆ xmlHashLookup3()

void* xmlHashLookup3 ( xmlHashTablePtr  table,
const xmlChar name,
const xmlChar name2,
const xmlChar name3 
)

Definition at line 767 of file hash.c.

768  {
769  unsigned long key;
771 
772  if (table == NULL)
773  return(NULL);
774  if (name == NULL)
775  return(NULL);
777  if (table->table[key].valid == 0)
778  return(NULL);
779  if (table->dict) {
780  for (entry = &(table->table[key]); entry != NULL; entry = entry->next) {
781  if ((entry->name == name) &&
782  (entry->name2 == name2) &&
783  (entry->name3 == name3))
784  return(entry->payload);
785  }
786  }
787  for (entry = &(table->table[key]); entry != NULL; entry = entry->next) {
788  if ((xmlStrEqual(entry->name, name)) &&
789  (xmlStrEqual(entry->name2, name2)) &&
790  (xmlStrEqual(entry->name3, name3)))
791  return(entry->payload);
792  }
793  return(NULL);
794 }
smooth NULL
Definition: ftsmooth.c:416
HKEY key
Definition: reg.c:42
uint32_t entry
Definition: isohybrid.c:63
static const WCHAR name3[]
Definition: db.c:2958
static unsigned long xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
Definition: hash.c:82
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
Definition: path.c:42

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

◆ xmlHashQLookup()

void* xmlHashQLookup ( xmlHashTablePtr  table,
const xmlChar prefix,
const xmlChar name 
)

Definition at line 490 of file hash.c.

491  {
492  return(xmlHashQLookup3(table, prefix, name, NULL, NULL, NULL, NULL));
493 }
void * xmlHashQLookup3(xmlHashTablePtr table, const xmlChar *prefix, const xmlChar *name, const xmlChar *prefix2, const xmlChar *name2, const xmlChar *prefix3, const xmlChar *name3)
Definition: hash.c:811
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:36

◆ xmlHashQLookup2()

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

Definition at line 508 of file hash.c.

510  {
511  return(xmlHashQLookup3(table, prefix, name, prefix2, name2, NULL, NULL));
512 }
void * xmlHashQLookup3(xmlHashTablePtr table, const xmlChar *prefix, const xmlChar *name, const xmlChar *prefix2, const xmlChar *name2, const xmlChar *prefix3, const xmlChar *name3)
Definition: hash.c:811
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35

Referenced by xmlParseAttribute2().

◆ xmlHashQLookup3()

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

Definition at line 811 of file hash.c.

814  {
815  unsigned long key;
817 
818  if (table == NULL)
819  return(NULL);
820  if (name == NULL)
821  return(NULL);
822  key = xmlHashComputeQKey(table, prefix, name, prefix2,
823  name2, prefix3, name3);
824  if (table->table[key].valid == 0)
825  return(NULL);
826  for (entry = &(table->table[key]); entry != NULL; entry = entry->next) {
827  if ((xmlStrQEqual(prefix, name, entry->name)) &&
828  (xmlStrQEqual(prefix2, name2, entry->name2)) &&
829  (xmlStrQEqual(prefix3, name3, entry->name3)))
830  return(entry->payload);
831  }
832  return(NULL);
833 }
XMLPUBFUN int XMLCALL xmlStrQEqual(const xmlChar *pref, const xmlChar *name, const xmlChar *str)
Definition: xmlstring.c:179
smooth NULL
Definition: ftsmooth.c:416
static unsigned long xmlHashComputeQKey(xmlHashTablePtr table, const xmlChar *prefix, const xmlChar *name, const xmlChar *prefix2, const xmlChar *name2, const xmlChar *prefix3, const xmlChar *name3)
Definition: hash.c:112
HKEY key
Definition: reg.c:42
uint32_t entry
Definition: isohybrid.c:63
static const WCHAR name3[]
Definition: db.c:2958
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35
Definition: path.c:42

Referenced by xmlHashQLookup(), and xmlHashQLookup2().

◆ xmlHashRemoveEntry()

int xmlHashRemoveEntry ( xmlHashTablePtr  table,
const xmlChar name,
xmlHashDeallocator  f 
)

Definition at line 1050 of file hash.c.

1051  {
1052  return(xmlHashRemoveEntry3(table, name, NULL, NULL, f));
1053 }
int xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashDeallocator f)
Definition: hash.c:1089
smooth NULL
Definition: ftsmooth.c:416
GLfloat f
Definition: glext.h:7540
Definition: name.c:36

Referenced by xmlRemoveID(), and xsltUnregisterExtModule().

◆ xmlHashRemoveEntry2()

int xmlHashRemoveEntry2 ( xmlHashTablePtr  table,
const xmlChar name,
const xmlChar name2,
xmlHashDeallocator  f 
)

Definition at line 1069 of file hash.c.

1070  {
1071  return(xmlHashRemoveEntry3(table, name, name2, NULL, f));
1072 }
int xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashDeallocator f)
Definition: hash.c:1089
smooth NULL
Definition: ftsmooth.c:416
GLfloat f
Definition: glext.h:7540
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35

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

◆ xmlHashRemoveEntry3()

int xmlHashRemoveEntry3 ( xmlHashTablePtr  table,
const xmlChar name,
const xmlChar name2,
const xmlChar name3,
xmlHashDeallocator  f 
)

Definition at line 1089 of file hash.c.

1090  {
1091  unsigned long key;
1093  xmlHashEntryPtr prev = NULL;
1094 
1095  if (table == NULL || name == NULL)
1096  return(-1);
1097 
1099  if (table->table[key].valid == 0) {
1100  return(-1);
1101  } else {
1102  for (entry = &(table->table[key]); entry != NULL; entry = entry->next) {
1103  if (xmlStrEqual(entry->name, name) &&
1104  xmlStrEqual(entry->name2, name2) &&
1105  xmlStrEqual(entry->name3, name3)) {
1106  if ((f != NULL) && (entry->payload != NULL))
1107  f(entry->payload, entry->name);
1108  entry->payload = NULL;
1109  if (table->dict == NULL) {
1110  if(entry->name)
1111  xmlFree(entry->name);
1112  if(entry->name2)
1113  xmlFree(entry->name2);
1114  if(entry->name3)
1115  xmlFree(entry->name3);
1116  }
1117  if(prev) {
1118  prev->next = entry->next;
1119  xmlFree(entry);
1120  } else {
1121  if (entry->next == NULL) {
1122  entry->valid = 0;
1123  } else {
1124  entry = entry->next;
1125  memcpy(&(table->table[key]), entry, sizeof(xmlHashEntry));
1126  xmlFree(entry);
1127  }
1128  }
1129  table->nbElems--;
1130  return(0);
1131  }
1132  prev = entry;
1133  }
1134  return(-1);
1135  }
1136 }
struct _xmlHashEntry * next
Definition: hash.c:56
smooth NULL
Definition: ftsmooth.c:416
GLfloat f
Definition: glext.h:7540
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
HKEY key
Definition: reg.c:42
uint32_t entry
Definition: isohybrid.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define f
Definition: ke_i.h:83
static const WCHAR name3[]
Definition: db.c:2958
static unsigned long xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
Definition: hash.c:82
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
Definition: path.c:42

Referenced by xmlHashRemoveEntry(), and xmlHashRemoveEntry2().

◆ xmlHashScan()

void xmlHashScan ( xmlHashTablePtr  table,
xmlHashScanner  f,
void data 
)

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

Scan the hash @table and applied @f to each value.

Definition at line 857 of file hash.c.

857  {
858  stubData stubdata;
859  stubdata.data = data;
860  stubdata.hashscanner = f;
862 }
xmlHashScanner hashscanner
Definition: hash.c:836
static void stubHashScannerFull(void *payload, void *data, const xmlChar *name, const xmlChar *name2 ATTRIBUTE_UNUSED, const xmlChar *name3 ATTRIBUTE_UNUSED)
Definition: hash.c:841
void xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data)
Definition: hash.c:873
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void * data
Definition: hash.c:837
#define f
Definition: ke_i.h:83
Definition: hash.c:835

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

◆ xmlHashScan3()

void xmlHashScan3 ( xmlHashTablePtr  table,
const xmlChar name,
const xmlChar name2,
const xmlChar name3,
xmlHashScanner  f,
void data 
)

Definition at line 924 of file hash.c.

926  {
927  stubData stubdata;
928  stubdata.data = data;
929  stubdata.hashscanner = f;
931  &stubdata);
932 }
xmlHashScanner hashscanner
Definition: hash.c:836
static void stubHashScannerFull(void *payload, void *data, const xmlChar *name, const xmlChar *name2 ATTRIBUTE_UNUSED, const xmlChar *name3 ATTRIBUTE_UNUSED)
Definition: hash.c:841
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void * data
Definition: hash.c:837
void xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashScannerFull f, void *data)
Definition: hash.c:948
#define f
Definition: ke_i.h:83
static const WCHAR name3[]
Definition: db.c:2958
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35
Definition: hash.c:835

◆ xmlHashScanFull()

void xmlHashScanFull ( xmlHashTablePtr  table,
xmlHashScannerFull  f,
void data 
)

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

Scan the hash @table and applied @f to each value.

Definition at line 873 of file hash.c.

873  {
874  int i, nb;
875  xmlHashEntryPtr iter;
877 
878  if (table == NULL)
879  return;
880  if (f == NULL)
881  return;
882 
883  if (table->table) {
884  for(i = 0; i < table->size; i++) {
885  if (table->table[i].valid == 0)
886  continue;
887  iter = &(table->table[i]);
888  while (iter) {
889  next = iter->next;
890  nb = table->nbElems;
891  if ((f != NULL) && (iter->payload != NULL))
892  f(iter->payload, data, iter->name,
893  iter->name2, iter->name3);
894  if (nb != table->nbElems) {
895  /* table was modified by the callback, be careful */
896  if (iter == &(table->table[i])) {
897  if (table->table[i].valid == 0)
898  iter = NULL;
899  if (table->table[i].next != next)
900  iter = &(table->table[i]);
901  } else
902  iter = next;
903  } else
904  iter = next;
905  }
906  }
907  }
908 }
struct _xmlHashEntry * next
Definition: hash.c:56
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
void * payload
Definition: hash.c:60
smooth NULL
Definition: ftsmooth.c:416
xmlChar * name
Definition: hash.c:57
GLfloat f
Definition: glext.h:7540
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static unsigned __int64 next
Definition: rand_nt.c:6
xmlChar * name3
Definition: hash.c:59
#define f
Definition: ke_i.h:83
xmlChar * name2
Definition: hash.c:58

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

◆ xmlHashScanFull3()

void xmlHashScanFull3 ( xmlHashTablePtr  table,
const xmlChar name,
const xmlChar name2,
const xmlChar name3,
xmlHashScannerFull  f,
void data 
)

Definition at line 948 of file hash.c.

950  {
951  int i;
952  xmlHashEntryPtr iter;
954 
955  if (table == NULL)
956  return;
957  if (f == NULL)
958  return;
959 
960  if (table->table) {
961  for(i = 0; i < table->size; i++) {
962  if (table->table[i].valid == 0)
963  continue;
964  iter = &(table->table[i]);
965  while (iter) {
966  next = iter->next;
967  if (((name == NULL) || (xmlStrEqual(name, iter->name))) &&
968  ((name2 == NULL) || (xmlStrEqual(name2, iter->name2))) &&
969  ((name3 == NULL) || (xmlStrEqual(name3, iter->name3))) &&
970  (iter->payload != NULL)) {
971  f(iter->payload, data, iter->name,
972  iter->name2, iter->name3);
973  }
974  iter = next;
975  }
976  }
977  }
978 }
struct _xmlHashEntry * next
Definition: hash.c:56
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
void * payload
Definition: hash.c:60
smooth NULL
Definition: ftsmooth.c:416
xmlChar * name
Definition: hash.c:57
GLfloat f
Definition: glext.h:7540
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static unsigned __int64 next
Definition: rand_nt.c:6
xmlChar * name3
Definition: hash.c:59
#define f
Definition: ke_i.h:83
xmlChar * name2
Definition: hash.c:58
static const WCHAR name3[]
Definition: db.c:2958
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157

Referenced by xmlHashScan3().

◆ xmlHashSize()

int xmlHashSize ( xmlHashTablePtr  table)

xmlHashSize: @table: the hash table

Query the number of elements installed in the hash @table.

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

Definition at line 1032 of file hash.c.

1032  {
1033  if (table == NULL)
1034  return(-1);
1035  return(table->nbElems);
1036 }
smooth NULL
Definition: ftsmooth.c:416

Referenced by xmlCleanSpecialAttr().

◆ xmlHashUpdateEntry()

int xmlHashUpdateEntry ( xmlHashTablePtr  table,
const xmlChar name,
void userdata,
xmlHashDeallocator  f 
)

Definition at line 423 of file hash.c.

424  {
425  return(xmlHashUpdateEntry3(table, name, NULL, NULL, userdata, f));
426 }
smooth NULL
Definition: ftsmooth.c:416
GLfloat f
Definition: glext.h:7540
int xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata, xmlHashDeallocator f)
Definition: hash.c:645
Definition: name.c:36

Referenced by xmlRemoveRef(), and xsltGatherNamespaces().

◆ xmlHashUpdateEntry2()

int xmlHashUpdateEntry2 ( xmlHashTablePtr  table,
const xmlChar name,
const xmlChar name2,
void userdata,
xmlHashDeallocator  f 
)

Definition at line 443 of file hash.c.

445  {
446  return(xmlHashUpdateEntry3(table, name, name2, NULL, userdata, f));
447 }
smooth NULL
Definition: ftsmooth.c:416
GLfloat f
Definition: glext.h:7540
int xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata, xmlHashDeallocator f)
Definition: hash.c:645
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35

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

◆ xmlHashUpdateEntry3()

int xmlHashUpdateEntry3 ( xmlHashTablePtr  table,
const xmlChar name,
const xmlChar name2,
const xmlChar name3,
void userdata,
xmlHashDeallocator  f 
)

Definition at line 645 of file hash.c.

647  {
648  unsigned long key;
651 
652  if ((table == NULL) || name == NULL)
653  return(-1);
654 
655  /*
656  * If using a dict internalize if needed
657  */
658  if (table->dict) {
659  if (!xmlDictOwns(table->dict, name)) {
660  name = xmlDictLookup(table->dict, name, -1);
661  if (name == NULL)
662  return(-1);
663  }
664  if ((name2 != NULL) && (!xmlDictOwns(table->dict, name2))) {
665  name2 = xmlDictLookup(table->dict, name2, -1);
666  if (name2 == NULL)
667  return(-1);
668  }
669  if ((name3 != NULL) && (!xmlDictOwns(table->dict, name3))) {
670  name3 = xmlDictLookup(table->dict, name3, -1);
671  if (name3 == NULL)
672  return(-1);
673  }
674  }
675 
676  /*
677  * Check for duplicate and insertion location.
678  */
680  if (table->table[key].valid == 0) {
681  insert = NULL;
682  } else {
683  if (table ->dict) {
684  for (insert = &(table->table[key]); insert->next != NULL;
685  insert = insert->next) {
686  if ((insert->name == name) &&
687  (insert->name2 == name2) &&
688  (insert->name3 == name3)) {
689  if (f)
690  f(insert->payload, insert->name);
691  insert->payload = userdata;
692  return(0);
693  }
694  }
695  if ((insert->name == name) &&
696  (insert->name2 == name2) &&
697  (insert->name3 == name3)) {
698  if (f)
699  f(insert->payload, insert->name);
700  insert->payload = userdata;
701  return(0);
702  }
703  } else {
704  for (insert = &(table->table[key]); insert->next != NULL;
705  insert = insert->next) {
706  if ((xmlStrEqual(insert->name, name)) &&
707  (xmlStrEqual(insert->name2, name2)) &&
708  (xmlStrEqual(insert->name3, name3))) {
709  if (f)
710  f(insert->payload, insert->name);
711  insert->payload = userdata;
712  return(0);
713  }
714  }
715  if ((xmlStrEqual(insert->name, name)) &&
716  (xmlStrEqual(insert->name2, name2)) &&
717  (xmlStrEqual(insert->name3, name3))) {
718  if (f)
719  f(insert->payload, insert->name);
720  insert->payload = userdata;
721  return(0);
722  }
723  }
724  }
725 
726  if (insert == NULL) {
727  entry = &(table->table[key]);
728  } else {
729  entry = xmlMalloc(sizeof(xmlHashEntry));
730  if (entry == NULL)
731  return(-1);
732  }
733 
734  if (table->dict != NULL) {
735  entry->name = (xmlChar *) name;
736  entry->name2 = (xmlChar *) name2;
737  entry->name3 = (xmlChar *) name3;
738  } else {
739  entry->name = xmlStrdup(name);
740  entry->name2 = xmlStrdup(name2);
741  entry->name3 = xmlStrdup(name3);
742  }
743  entry->payload = userdata;
744  entry->next = NULL;
745  entry->valid = 1;
746  table->nbElems++;
747 
748 
749  if (insert != NULL) {
750  insert->next = entry;
751  }
752  return(0);
753 }
static int insert
Definition: xmllint.c:144
smooth NULL
Definition: ftsmooth.c:416
GLfloat f
Definition: glext.h:7540
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:858
HKEY key
Definition: reg.c:42
uint32_t entry
Definition: isohybrid.c:63
unsigned char xmlChar
Definition: xmlstring.h:28
#define f
Definition: ke_i.h:83
XMLPUBFUN int XMLCALL xmlDictOwns(xmlDictPtr dict, const xmlChar *str)
Definition: dict.c:1211
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
static const WCHAR name3[]
Definition: db.c:2958
static unsigned long xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
Definition: hash.c:82
Definition: name.c:36
static WCHAR name2[]
Definition: record.c:35
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
Definition: path.c:42

Referenced by xmlHashUpdateEntry(), xmlHashUpdateEntry2(), and xsltAddTemplate().