diff options
Diffstat (limited to 'decorate.c')
| -rw-r--r-- | decorate.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/decorate.c b/decorate.c index 2036d15967..69aeb142b4 100644 --- a/decorate.c +++ b/decorate.c @@ -2,7 +2,7 @@ * decorate.c - decorate a git object with some arbitrary * data. */ -#include "cache.h" +#include "git-compat-util.h" #include "object.h" #include "decorate.h" @@ -81,3 +81,18 @@ void *lookup_decoration(struct decoration *n, const struct object *obj) j = 0; } } + +void clear_decoration(struct decoration *n, void (*free_cb)(void *)) +{ + if (free_cb) { + unsigned int i; + for (i = 0; i < n->size; i++) { + void *d = n->entries[i].decoration; + if (d) + free_cb(d); + } + } + + FREE_AND_NULL(n->entries); + n->size = n->nr = 0; +} |
