void *Next;
const char* KeyStr;
+ if (Hash == NULL)
+ return 0;
+
for (i=0; i < Hash->nMembersUsed; i++) {
if (i==0) {
Previous = NULL;
const char *bla = "";
long key;
long i;
+
+ if (Hash == NULL)
+ return 0;
+
if (Hash->MyKeys != NULL)
free (Hash->MyKeys);
return NewList;
}
+int GetCount(HashList *Hash)
+{
+ if(Hash==NULL) return 0;
+ return Hash->nMembersUsed;
+}
+
+
/**
* \brief private destructor for one hash element.
* \param Data an element to free using the user provided destructor, or just plain free
Payload **NewPayloadArea;
HashKey **NewTable;
+ if (Hash == NULL)
+ return ;
+
/** double our payload area */
NewPayloadArea = (Payload**) malloc(sizeof(Payload*) * Hash->MemberSize * 2);
memset(&NewPayloadArea[Hash->MemberSize], 0, sizeof(Payload*) * Hash->MemberSize);
Payload *NewPayloadItem;
HashKey *NewHashKey;
+ if (Hash == NULL)
+ return;
+
if (Hash->nMembersUsed >= Hash->MemberSize)
IncreaseHashSize (Hash);
/** but if we should be sorted into a specific place... */
if ((Hash->nMembersUsed != 0) &&
(HashPos != Hash->nMembersUsed) ) {
- long InsertAt;
long ItemsAfter;
ItemsAfter = Hash->nMembersUsed - HashPos;
- InsertAt = HashPos;
/** make space were we can fill us in */
if (ItemsAfter > 0)
{
- memmove(&Hash->LookupTable[InsertAt + 1],
- &Hash->LookupTable[InsertAt],
+ memmove(&Hash->LookupTable[HashPos + 1],
+ &Hash->LookupTable[HashPos],
ItemsAfter * sizeof(HashKey*));
}
}
{
long SearchPos;
+ if (Hash == NULL)
+ return 0;
+
for (SearchPos = 0; SearchPos < Hash->nMembersUsed; SearchPos ++) {
if (Hash->LookupTable[SearchPos]->Key == HashBinKey){
return SearchPos;
long SearchPos;
long StepWidth;
+ if (Hash == NULL)
+ return 0;
+
if (Hash->tainted)
return FindInTaintedHash(Hash, HashBinKey);
*/
inline static long CalcHashKey (HashList *Hash, const char *HKey, long HKLen)
{
+ if (Hash == NULL)
+ return 0;
+
if (Hash->Algorithm == NULL)
return hashlittle(HKey, HKLen, 9283457);
else
long HashBinKey;
long HashAt;
+ if (Hash == NULL)
+ return;
+
/** first, find out were we could fit in... */
HashBinKey = CalcHashKey(Hash, HKey, HKLen);
HashAt = FindInHash(Hash, HashBinKey);
long HashBinKey;
long HashAt;
+ if (Hash == NULL)
+ return 0;
+
if (HKLen <= 0) {
*Data = NULL;
return 0;
int GetHashKeys(HashList *Hash, char ***List)
{
long i;
+ if (Hash == NULL)
+ return 0;
if (Hash->MyKeys != NULL)
free (Hash->MyKeys);
*/
void DeleteHashPos(HashPos **DelMe)
{
- free(*DelMe);
- *DelMe = NULL;
+ if (*DelMe != NULL)
+ {
+ free(*DelMe);
+ *DelMe = NULL;
+ }
}
{
long PayloadPos;
- if (Hash->nMembersUsed <= At->Position)
+ if ((Hash == NULL) || (Hash->nMembersUsed <= At->Position))
return 0;
*HKLen = Hash->LookupTable[At->Position]->HKLen;
*HashKey = Hash->LookupTable[At->Position]->HashKey;