summaryrefslogtreecommitdiff
path: root/src/strmap.h
diff options
context:
space:
mode:
authorNico von Geyso <Nico.Geyso@FU-Berlin.de>2013-03-17 20:39:01 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2013-08-08 11:07:03 +0200
commit6385fc5ff5d669d3ec99d89f19c5860cf53011ba (patch)
tree56dfda0bba992c09c7d336600f1844b95d0ae863 /src/strmap.h
parentc7d4904c47d493073b8f816d2b17dcf68eefe26d (diff)
downloadlibgit2-6385fc5ff5d669d3ec99d89f19c5860cf53011ba.tar.gz
added new type and several functions to git_strmap
This step is needed to easily add iterators to git_config_backend As well use these new git_strmap functions to implement foreach * git_strmap_iter * git_strmap_has_data(...) * git_strmap_begin(...) * git_strmap_end(...) * git_strmap_next(...)
Diffstat (limited to 'src/strmap.h')
-rw-r--r--src/strmap.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/strmap.h b/src/strmap.h
index 44176a0fc..cb079b500 100644
--- a/src/strmap.h
+++ b/src/strmap.h
@@ -17,6 +17,7 @@
__KHASH_TYPE(str, const char *, void *);
typedef khash_t(str) git_strmap;
+typedef khiter_t git_strmap_iter;
#define GIT__USE_STRMAP \
__KHASH_IMPL(str, static kh_inline, const char *, void *, 1, kh_str_hash_func, kh_str_hash_equal)
@@ -31,7 +32,9 @@ typedef khash_t(str) git_strmap;
#define git_strmap_valid_index(h, idx) (idx != kh_end(h))
#define git_strmap_exists(h, k) (kh_get(str, h, k) != kh_end(h))
+#define git_strmap_has_data(h, idx) kh_exist(h, idx)
+#define git_strmap_key(h, idx) kh_key(h, idx)
#define git_strmap_value_at(h, idx) kh_val(h, idx)
#define git_strmap_set_value_at(h, idx, v) kh_val(h, idx) = v
#define git_strmap_delete_at(h, idx) kh_del(str, h, idx)
@@ -61,4 +64,13 @@ typedef khash_t(str) git_strmap;
#define git_strmap_foreach kh_foreach
#define git_strmap_foreach_value kh_foreach_value
+#define git_strmap_begin kh_begin
+#define git_strmap_end kh_end
+
+int git_strmap_next(
+ const char **key,
+ void **data,
+ git_strmap_iter* iter,
+ git_strmap *map);
+
#endif