Merge branch 'sb/string-list-remove-unused' into maint
[gitweb.git] / oidmap.h
index 18f54cde143e58403fb448d227e9342540bbd0fc..72430b611ebf710b4c3ba0160af91104258db138 100644 (file)
--- a/oidmap.h
+++ b/oidmap.h
@@ -1,6 +1,7 @@
 #ifndef OIDMAP_H
 #define OIDMAP_H
 
+#include "cache.h"
 #include "hashmap.h"
 
 /*
@@ -65,4 +66,26 @@ extern void *oidmap_put(struct oidmap *map, void *entry);
  */
 extern void *oidmap_remove(struct oidmap *map, const struct object_id *key);
 
+
+struct oidmap_iter {
+       struct hashmap_iter h_iter;
+};
+
+static inline void oidmap_iter_init(struct oidmap *map, struct oidmap_iter *iter)
+{
+       hashmap_iter_init(&map->map, &iter->h_iter);
+}
+
+static inline void *oidmap_iter_next(struct oidmap_iter *iter)
+{
+       return hashmap_iter_next(&iter->h_iter);
+}
+
+static inline void *oidmap_iter_first(struct oidmap *map,
+                                     struct oidmap_iter *iter)
+{
+       oidmap_iter_init(map, iter);
+       return oidmap_iter_next(iter);
+}
+
 #endif