summaryrefslogtreecommitdiff
path: root/src/strmap.c
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-08-28 06:04:51 -0700
committerVicent Martí <vicent@github.com>2013-08-28 06:04:51 -0700
commitb8b22d774eca054fe43005accd6f3ff58fc1fb62 (patch)
tree69d507f28a168f4f7f4cd3172e331403ff14e36e /src/strmap.c
parent21a3bbe419e8edb8a119f5c2a2de85f462078d3d (diff)
parentf4be8209afd3cc996667196a1e437aac21485691 (diff)
downloadlibgit2-b8b22d774eca054fe43005accd6f3ff58fc1fb62.tar.gz
Merge pull request #1772 from libgit2/config-iter
Configuration iterators redux
Diffstat (limited to 'src/strmap.c')
-rw-r--r--src/strmap.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/strmap.c b/src/strmap.c
new file mode 100644
index 000000000..b26a13d1f
--- /dev/null
+++ b/src/strmap.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) the libgit2 contributors. All rights reserved.
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+
+#include "strmap.h"
+
+int git_strmap_next(
+ void **data,
+ git_strmap_iter* iter,
+ git_strmap *map)
+{
+ if (!map)
+ return GIT_ERROR;
+
+ while (*iter != git_strmap_end(map)) {
+ if (!(git_strmap_has_data(map, *iter))) {
+ ++(*iter);
+ continue;
+ }
+
+ *data = git_strmap_value_at(map, *iter);
+
+ ++(*iter);
+
+ return GIT_OK;
+ }
+
+ return GIT_ITEROVER;
+}