]> code.citadel.org Git - citadel.git/blobdiff - libcitadel/lib/hash.c
* zero-safe StrtoI/L
[citadel.git] / libcitadel / lib / hash.c
index 9ab2aa6e3db5440ef412c170dbb12c676edc46a7..e9796343f273832ca10926b37ae5f279f9fd6d8e 100644 (file)
@@ -195,6 +195,15 @@ static void DeleteHashPayload (Payload *Data)
                free(Data->Data);
 }
 
+/**
+ * \brief Destructor for nested hashes
+ */
+void HDeleteHash(void *vHash)
+{
+       HashList *FreeMe = (HashList*)vHash;
+       DeleteHash(&FreeMe);
+}
+
 /**
  * \brief destroy a hashlist and all of its members
  * Crashing? do 'print *FreeMe->LookupTable[i]'
@@ -400,6 +409,20 @@ static long FindInHash(HashList *Hash, long HashBinKey)
        return SearchPos;
 }
 
+
+/**
+ * \brief another hashing algorithm; treat it as just a pointer to long.
+ * \param str Our pointer to the long value
+ * \param len the length of the data pointed to; needs to be sizeof int, else we won't use it!
+ * \returns the calculated hash value
+ */
+int Flathash(const char *str, long len)
+{
+       if (len != sizeof (int))
+               return 0;
+       else return *(int*)str;
+}
+
 /**
  * \brief private abstract wrapper around the hashing algorithm
  * \param HKey the hash string
@@ -703,5 +726,14 @@ void generic_free_handler(void *ptr) {
        free(ptr);
 }
 
+/*
+ * Generic function to free a reference.  
+ * since a reference actualy isn't needed to be freed, do nothing.
+ */
+void reference_free_handler(void *ptr) 
+{
+       1;
+}
+