Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Move the ref list code into ui-refs.c
Diffstat (limited to '')
| -rw-r--r-- | source/shared.c | 58 |
1 file changed, 0 insertions, 58 deletions
diff --git a/source/shared.c b/source/shared.c index c881fac..c3867f6 100644 --- a/source/shared.c +++ b/source/shared.c @@ -20,43 +20,6 @@ struct cgit_repolist cgit_repolist; struct cgit_context ctx; char cgit_default_repo_desc[] = "[no description]"; -static void free_refinfo(struct refinfo *ref) -{ - free((char *)ref->refname); - switch (ref->object->type) { - case OBJ_TAG: - cgit_free_taginfo(ref->tag); - break; - case OBJ_COMMIT: - cgit_free_commitinfo(ref->commit); - break; - } - free(ref); -} - -static struct refinfo *make_refinfo(const char *refname, const struct object_id *oid) -{ - struct refinfo *ref; - - ref = xcalloc(1, sizeof(struct refinfo)); - ref->refname = xstrdup(refname); - ref->object = parse_object(the_repository, oid); - if (!ref->object) { - free((char *)ref->refname); - free(ref); - return NULL; - } - switch (ref->object->type) { - case OBJ_TAG: - ref->tag = cgit_parse_tag((struct tag *)ref->object); - break; - case OBJ_COMMIT: - ref->commit = cgit_parse_commit((struct commit *)ref->object); - break; - } - return ref; -} - /* * Git's wider syntax is refused, since :/pattern and rev^{/pattern} walk the * whole history for a match, and a leading dash reads as an option further @@ -267,27 +230,6 @@ void cgit_free_taginfo(struct taginfo *info) free(info); } -void cgit_free_reflist_inner(struct reflist *list) -{ - int i; - - for (i = 0; i < list->count; i++) - free_refinfo(list->refs[i]); - free(list->refs); -} - -int cgit_refs_cb(const struct reference *ref, void *cb_data) -{ - struct reflist *list = (struct reflist *)cb_data; - struct refinfo *info = make_refinfo(ref->name, ref->oid); - - if (info) { - ALLOC_GROW(list->refs, list->count + 1, list->alloc); - list->refs[list->count++] = info; - } - return 0; -} - void cgit_diff_tree_cb(struct diff_queue_struct *q, struct diff_options *options UNUSED, void *data) { filepair_fn fn = *(filepair_fn *)data; |
