diff options
Diffstat (limited to 'shared.c')
-rw-r--r-- | shared.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -176,6 +176,42 @@ static struct refinfo *cgit_mk_refinfo(const char *refname, const unsigned char | |||
176 | return ref; | 176 | return ref; |
177 | } | 177 | } |
178 | 178 | ||
179 | static void cgit_free_taginfo(struct taginfo *tag) | ||
180 | { | ||
181 | if (tag->tagger) | ||
182 | free(tag->tagger); | ||
183 | if (tag->tagger_email) | ||
184 | free(tag->tagger_email); | ||
185 | if (tag->msg) | ||
186 | free(tag->msg); | ||
187 | free(tag); | ||
188 | } | ||
189 | |||
190 | static void cgit_free_refinfo(struct refinfo *ref) | ||
191 | { | ||
192 | if (ref->refname) | ||
193 | free((char *)ref->refname); | ||
194 | switch (ref->object->type) { | ||
195 | case OBJ_TAG: | ||
196 | cgit_free_taginfo(ref->tag); | ||
197 | break; | ||
198 | case OBJ_COMMIT: | ||
199 | cgit_free_commitinfo(ref->commit); | ||
200 | break; | ||
201 | } | ||
202 | free(ref); | ||
203 | } | ||
204 | |||
205 | void cgit_free_reflist_inner(struct reflist *list) | ||
206 | { | ||
207 | int i; | ||
208 | |||
209 | for (i = 0; i < list->count; i++) { | ||
210 | cgit_free_refinfo(list->refs[i]); | ||
211 | } | ||
212 | free(list->refs); | ||
213 | } | ||
214 | |||
179 | int cgit_refs_cb(const char *refname, const unsigned char *sha1, int flags, | 215 | int cgit_refs_cb(const char *refname, const unsigned char *sha1, int flags, |
180 | void *cb_data) | 216 | void *cb_data) |
181 | { | 217 | { |