return i;
}
+const char *dbg_PrintStrBufPayload(const char *Key, void *Item, int Odd)
+{
+ return ChrPtr((StrBuf*)Item);
+}
/**
* @ingroup HashListDebug
}
#ifdef DEBUG
- printf (" ---- Hashkey[%ld][%ld]: '%s' Value: '%s' ; %s\n", i, key, foo, bar, bla);
+ if ((Hash->Algorithm == lFlathash) || (Hash->Algorithm == Flathash)) {
+ printf (" ---- Hashkey[%ld][%ld]: %ld '%s' Value: '%s' ; %s\n", i, key, *(long*) foo, foo, bar, bla);
+ }
+ else {
+ printf (" ---- Hashkey[%ld][%ld]: '%s' Value: '%s' ; %s\n", i, key, foo, bar, bla);
+ }
#endif
}
#ifdef DEBUG
long Flathash(const char *str, long len)
{
if (len != sizeof (int))
+ {
+#ifdef DEBUG
+ int *crash = NULL;
+ *crash = 1;
+#endif
return 0;
+ }
else return *(int*)str;
}
long lFlathash(const char *str, long len)
{
if (len != sizeof (long))
+ {
+#ifdef DEBUG
+ int *crash = NULL;
+ *crash = 1;
+#endif
return 0;
+ }
else return *(long*)str;
}
* step-raster is provided.
* @return the hash iterator
*/
-HashPos *GetNewHashPos(HashList *Hash, int StepWidth)
+HashPos *GetNewHashPos(const HashList *Hash, int StepWidth)
{
HashPos *Ret;
return Ret;
}
+/**
+ * @ingroup HashListAccess
+ * @brief resets a hash-linear iterator object
+ * @param Hash the list we reference
+ * @param StepWidth in which step width should we iterate?
+ * @param it the iterator object to manipulate
+ * If negative, the last position matching the
+ * step-raster is provided.
+ * @return the hash iterator
+ */
+void RewindHashPos(const HashList *Hash, HashPos *it, int StepWidth)
+{
+ if (StepWidth != 0)
+ it->StepWidth = StepWidth;
+ else
+ it->StepWidth = 1;
+ if (it->StepWidth < 0) {
+ it->Position = Hash->nLookupTableItems - 1;
+ }
+ else {
+ it->Position = 0;
+ }
+}
+
/**
* @ingroup HashListAccess
* @brief Set iterator object to point to key. If not found, don't change iterator
* @param Data returns the Data found at HashPos
* @return whether the item was found or not.
*/
-int GetNextHashPos(HashList *Hash, HashPos *At, long *HKLen, const char **HashKey, void **Data)
+int GetNextHashPos(const HashList *Hash, HashPos *At, long *HKLen, const char **HashKey, void **Data)
{
long PayloadPos;