+/**
+ * We are about to free() the @a bme, make sure it is not in
+ * the list of next values for any iterator in the @a map's next_cache.
+ *
+ * @param map the map to check
+ * @param bme the entry that is about to be free'd
+ */
+static void
+update_next_cache_bme (struct GNUNET_CONTAINER_MultiShortmap *map,
+ const struct BigMapEntry *bme)
+{
+ for (unsigned int i=0;i<map->next_cache_off;i++)
+ if (map->next_cache[i].bme == bme)
+ map->next_cache[i].bme = bme->next;
+}
+
+
+/**
+ * We are about to free() the @a sme, make sure it is not in
+ * the list of next values for any iterator in the @a map's next_cache.
+ *
+ * @param map the map to check
+ * @param sme the entry that is about to be free'd
+ */
+static void
+update_next_cache_sme (struct GNUNET_CONTAINER_MultiShortmap *map,
+ const struct SmallMapEntry *sme)
+{
+ for (unsigned int i=0;i<map->next_cache_off;i++)
+ if (map->next_cache[i].sme == sme)
+ map->next_cache[i].sme = sme->next;
+}
+
+