Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'strmap.c')
-rw-r--r--strmap.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/strmap.c b/strmap.c
index c410c5241a..0d10a884b5 100644
--- a/strmap.c
+++ b/strmap.c
@@ -123,3 +123,14 @@ void strmap_remove(struct strmap *map, const char *str, int free_value)
free((char*)ret->key);
free(ret);
}
+
+void strintmap_incr(struct strintmap *map, const char *str, intptr_t amt)
+{
+ struct strmap_entry *entry = find_strmap_entry(&map->map, str);
+ if (entry) {
+ intptr_t *whence = (intptr_t*)&entry->value;
+ *whence += amt;
+ }
+ else
+ strintmap_set(map, str, map->default_value + amt);
+}