summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2012-11-12 12:42:19 +0000
committerkr.angelov <kr.angelov@gmail.com>2012-11-12 12:42:19 +0000
commit6784a4c76eeb66285791e5c1c99ee876949ced52 (patch)
treee5ae71a9dd856fe9d0b269ad28ea6aaa8e0e6204
parent63093c32f33ad1fcfef10d2ef6ef010c2b5471e9 (diff)
implemented gu_map_count in runtime/c/gu/map.c
-rw-r--r--src/runtime/c/gu/map.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/runtime/c/gu/map.c b/src/runtime/c/gu/map.c
index 312723f8a..2a818d8be 100644
--- a/src/runtime/c/gu/map.c
+++ b/src/runtime/c/gu/map.c
@@ -303,6 +303,19 @@ gu_map_iter(GuMap* map, GuMapItor* itor, GuExn* err)
}
}
+size_t
+gu_map_count(GuMap* map)
+{
+ size_t count = 0;
+ for (size_t i = 0; i < map->data.n_entries; i++) {
+ if (gu_map_entry_is_free(map, &map->data, i)) {
+ continue;
+ }
+ count++;
+ }
+ return count;
+}
+
static const uint8_t gu_map_no_values[1] = { 0 };
GuMap*