* zero-safe StrtoI/L
[citadel.git] / libcitadel / lib / hash.c
index a8340f493532ba042afcfa698a25e0a763b6c0e2..e9796343f273832ca10926b37ae5f279f9fd6d8e 100644 (file)
@@ -409,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