ReactOS  0.4.14-dev-41-g31d7680
sdbstringtable.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void SdbpTableDestroy (struct SdbStringHashTable **table)
 
BOOL SdbpAddStringToTable (struct SdbStringHashTable **table, const WCHAR *str, TAGID *pTagid)
 

Function Documentation

◆ SdbpAddStringToTable()

BOOL SdbpAddStringToTable ( struct SdbStringHashTable **  table,
const WCHAR str,
TAGID pTagid 
)

Find an entry in the stringtable, or allocate it when an entry could not be found.

  • When the string specified does not yet exist, a new entry will be added to the table, and the pTagid specified will be associated with this string.
  • When the string specified does already exist, the TAGID associated with this string will be returned in pTagid.
Parameters
[in]tablePointer to table pointer, will be allocated when needed.
[in]strThe string to search for
[in,out]pTagid

the data written (in bytes)

Returns
TRUE if the string was added to the table, FALSE if it already existed

Definition at line 169 of file sdbstringtable.c.

170 {
171  struct SdbHashEntry** entry;
172 
173  if (!*table)
174  {
175  *table = HashCreate();
176  if (!*table)
177  {
178  SHIM_ERR("Error creating hash table\n");
179  return FALSE;
180  }
181  }
182 
184  if (*entry)
185  {
186  *tagid = (*entry)->Tagid;
187  return FALSE;
188  }
189  return HashAddString(*table, entry, str, *tagid);
190 }
const WCHAR * str
static BOOL HashAddString(struct SdbStringHashTable *table, struct SdbHashEntry **position, const WCHAR *str, TAGID tagid)
uint32_t entry
Definition: isohybrid.c:63
static struct SdbStringHashTable * HashCreate(void)
static struct SdbHashEntry ** TableFindPtr(struct SdbStringHashTable *table, const WCHAR *str)

Referenced by SdbpGetOrAddStringRef().

◆ SdbpTableDestroy()

void SdbpTableDestroy ( struct SdbStringHashTable **  table)

Destroy the hashtable and release all resources.

Parameters
[in]tablePointer to table pointer, will be cleared after use

Definition at line 60 of file sdbstringtable.c.

61 {
62  struct SdbStringHashTable* table = *pTable;
63  struct SdbHashEntry* entry, *next;
64  DWORD n, depth = 0, once = 1;
65 
66  *pTable = NULL;
67  for (n = 0; n < table->Size; ++n)
68  {
69  depth = 0;
70  entry = next = table->Entries[n];
71  while (entry)
72  {
73  next = entry->Next;
74  SdbFree(entry);
75  entry = next;
76  depth++;
77  }
78  if (once && depth > 3)
79  {
80  // warn
81  once = 0;
82  }
83  }
84  SdbFree(table->Entries);
85  SdbFree(table);
86 }
GLdouble n
Definition: glext.h:7729
#define SdbFree(mem)
Definition: sdbpapi.h:37
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
uint32_t entry
Definition: isohybrid.c:63
static unsigned __int64 next
Definition: rand_nt.c:6
static const EHCI_PERIOD pTable[]
Definition: usbehci.c:29

Referenced by SdbCloseDatabase().