From: Thiago Farina Date: Sat, 27 Nov 2010 01:58:14 +0000 (-0200) Subject: commit: Add commit_list prefix in two function names. X-Git-Tag: v1.7.4-rc0~13^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=47e44ed1dc17d3a94ec4bf8dd29810ab7882041c;p=git.git commit: Add commit_list prefix in two function names. Add commit_list prefix to insert_by_date function and to sort_by_date, so it's clear that these functions refer to commit_list structure. Signed-off-by: Thiago Farina Signed-off-by: Junio C Hamano --- diff --git a/builtin/describe.c b/builtin/describe.c index 43caff2ff..9304dd0cc 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -189,7 +189,7 @@ static unsigned long finish_depth_computation( struct commit *p = parents->item; parse_commit(p); if (!(p->object.flags & SEEN)) - insert_by_date(p, list); + commit_list_insert_by_date(p, list); p->object.flags |= c->object.flags; parents = parents->next; } @@ -300,7 +300,7 @@ static void describe(const char *arg, int last_one) struct commit *p = parents->item; parse_commit(p); if (!(p->object.flags & SEEN)) - insert_by_date(p, &list); + commit_list_insert_by_date(p, &list); p->object.flags |= c->object.flags; parents = parents->next; } @@ -328,7 +328,7 @@ static void describe(const char *arg, int last_one) qsort(all_matches, match_cnt, sizeof(all_matches[0]), compare_pt); if (gave_up_on) { - insert_by_date(gave_up_on, &list); + commit_list_insert_by_date(gave_up_on, &list); seen_commits--; } seen_commits += finish_depth_computation(&list, &all_matches[0]); diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index dbd8b7bcc..b99941393 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -47,7 +47,7 @@ static void rev_list_push(struct commit *commit, int mark) if (parse_commit(commit)) return; - insert_by_date(commit, &rev_list); + commit_list_insert_by_date(commit, &rev_list); if (!(commit->object.flags & COMMON)) non_common_revs++; @@ -436,7 +436,7 @@ static int mark_complete(const char *path, const unsigned char *sha1, int flag, if (o && o->type == OBJ_COMMIT) { struct commit *commit = (struct commit *)o; commit->object.flags |= COMPLETE; - insert_by_date(commit, &complete); + commit_list_insert_by_date(commit, &complete); } return 0; } diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 8663ccaa9..da695815e 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -243,7 +243,7 @@ static void join_revs(struct commit_list **list_p, if (mark_seen(p, seen_p) && !still_interesting) extra--; p->object.flags |= flags; - insert_by_date(p, list_p); + commit_list_insert_by_date(p, list_p); } } @@ -859,7 +859,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) */ commit->object.flags |= flag; if (commit->object.flags == flag) - insert_by_date(commit, &list); + commit_list_insert_by_date(commit, &list); rev[num_rev] = commit; } for (i = 0; i < num_rev; i++) @@ -868,7 +868,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) if (0 <= extra) join_revs(&list, &seen, num_rev, extra); - sort_by_date(&seen); + commit_list_sort_by_date(&seen); if (merge_base) return show_merge_base(seen, num_rev); diff --git a/commit.c b/commit.c index 0094ec1c9..554dcc3c7 100644 --- a/commit.c +++ b/commit.c @@ -360,7 +360,7 @@ void free_commit_list(struct commit_list *list) } } -struct commit_list * insert_by_date(struct commit *item, struct commit_list **list) +struct commit_list * commit_list_insert_by_date(struct commit *item, struct commit_list **list) { struct commit_list **pp = list; struct commit_list *p; @@ -374,11 +374,11 @@ struct commit_list * insert_by_date(struct commit *item, struct commit_list **li } -void sort_by_date(struct commit_list **list) +void commit_list_sort_by_date(struct commit_list **list) { struct commit_list *ret = NULL; while (*list) { - insert_by_date((*list)->item, &ret); + commit_list_insert_by_date((*list)->item, &ret); *list = (*list)->next; } *list = ret; @@ -398,7 +398,7 @@ struct commit *pop_most_recent_commit(struct commit_list **list, struct commit *commit = parents->item; if (!parse_commit(commit) && !(commit->object.flags & mark)) { commit->object.flags |= mark; - insert_by_date(commit, list); + commit_list_insert_by_date(commit, list); } parents = parents->next; } @@ -487,7 +487,7 @@ void sort_in_topological_order(struct commit_list ** list, int lifo) /* process the list in topological order */ if (!lifo) - sort_by_date(&work); + commit_list_sort_by_date(&work); pptr = list; *list = NULL; @@ -513,7 +513,7 @@ void sort_in_topological_order(struct commit_list ** list, int lifo) */ if (--parent->indegree == 1) { if (!lifo) - insert_by_date(parent, &work); + commit_list_insert_by_date(parent, &work); else commit_list_insert(parent, &work); } @@ -573,10 +573,10 @@ static struct commit_list *merge_bases_many(struct commit *one, int n, struct co } one->object.flags |= PARENT1; - insert_by_date(one, &list); + commit_list_insert_by_date(one, &list); for (i = 0; i < n; i++) { twos[i]->object.flags |= PARENT2; - insert_by_date(twos[i], &list); + commit_list_insert_by_date(twos[i], &list); } while (interesting(list)) { @@ -594,7 +594,7 @@ static struct commit_list *merge_bases_many(struct commit *one, int n, struct co if (flags == (PARENT1 | PARENT2)) { if (!(commit->object.flags & RESULT)) { commit->object.flags |= RESULT; - insert_by_date(commit, &result); + commit_list_insert_by_date(commit, &result); } /* Mark parents of a found merge stale */ flags |= STALE; @@ -608,7 +608,7 @@ static struct commit_list *merge_bases_many(struct commit *one, int n, struct co if (parse_commit(p)) return NULL; p->object.flags |= flags; - insert_by_date(p, &list); + commit_list_insert_by_date(p, &list); } } @@ -618,7 +618,7 @@ static struct commit_list *merge_bases_many(struct commit *one, int n, struct co while (list) { struct commit_list *next = list->next; if (!(list->item->object.flags & STALE)) - insert_by_date(list->item, &result); + commit_list_insert_by_date(list->item, &result); free(list); list = next; } @@ -711,7 +711,7 @@ struct commit_list *get_merge_bases_many(struct commit *one, result = NULL; for (i = 0; i < cnt; i++) { if (rslt[i]) - insert_by_date(rslt[i], &result); + commit_list_insert_by_date(rslt[i], &result); } free(rslt); return result; diff --git a/commit.h b/commit.h index 9113bbe48..6452928d5 100644 --- a/commit.h +++ b/commit.h @@ -38,20 +38,20 @@ struct commit *lookup_commit_reference_gently(const unsigned char *sha1, int quiet); int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size); - int parse_commit(struct commit *item); /* Find beginning and length of commit subject. */ int find_commit_subject(const char *commit_buffer, const char **subject); -struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p); +struct commit_list *commit_list_insert(struct commit *item, + struct commit_list **list); unsigned commit_list_count(const struct commit_list *l); -struct commit_list * insert_by_date(struct commit *item, struct commit_list **list); +struct commit_list *commit_list_insert_by_date(struct commit *item, + struct commit_list **list); +void commit_list_sort_by_date(struct commit_list **list); void free_commit_list(struct commit_list *list); -void sort_by_date(struct commit_list **list); - /* Commit formats */ enum cmit_fmt { CMIT_FMT_RAW, diff --git a/revision.c b/revision.c index b1c18906b..f8d4f8727 100644 --- a/revision.c +++ b/revision.c @@ -444,15 +444,15 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit) commit->object.flags |= TREESAME; } -static void insert_by_date_cached(struct commit *p, struct commit_list **head, +static void commit_list_insert_by_date_cached(struct commit *p, struct commit_list **head, struct commit_list *cached_base, struct commit_list **cache) { struct commit_list *new_entry; if (cached_base && p->date < cached_base->item->date) - new_entry = insert_by_date(p, &cached_base->next); + new_entry = commit_list_insert_by_date(p, &cached_base->next); else - new_entry = insert_by_date(p, head); + new_entry = commit_list_insert_by_date(p, head); if (cache && (!*cache || p->date < (*cache)->item->date)) *cache = new_entry; @@ -494,7 +494,7 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, if (p->object.flags & SEEN) continue; p->object.flags |= SEEN; - insert_by_date_cached(p, list, cached_base, cache_ptr); + commit_list_insert_by_date_cached(p, list, cached_base, cache_ptr); } return 0; } @@ -521,7 +521,7 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, p->object.flags |= left_flag; if (!(p->object.flags & SEEN)) { p->object.flags |= SEEN; - insert_by_date_cached(p, list, cached_base, cache_ptr); + commit_list_insert_by_date_cached(p, list, cached_base, cache_ptr); } if (revs->first_parent_only) break; @@ -1891,7 +1891,7 @@ int prepare_revision_walk(struct rev_info *revs) if (commit) { if (!(commit->object.flags & SEEN)) { commit->object.flags |= SEEN; - insert_by_date(commit, &revs->commits); + commit_list_insert_by_date(commit, &revs->commits); } } e++; diff --git a/sha1_name.c b/sha1_name.c index 3e856b803..a96de0bda 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -683,7 +683,7 @@ static int handle_one_ref(const char *path, } if (object->type != OBJ_COMMIT) return 0; - insert_by_date((struct commit *)object, list); + commit_list_insert_by_date((struct commit *)object, list); object->flags |= ONELINE_SEEN; return 0; } diff --git a/upload-pack.c b/upload-pack.c index f05e4229d..b40a43f27 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -366,7 +366,7 @@ static int reachable(struct commit *want) { struct commit_list *work = NULL; - insert_by_date(want, &work); + commit_list_insert_by_date(want, &work); while (work) { struct commit_list *list = work->next; struct commit *commit = work->item; @@ -387,7 +387,7 @@ static int reachable(struct commit *want) for (list = commit->parents; list; list = list->next) { struct commit *parent = list->item; if (!(parent->object.flags & REACHABLE)) - insert_by_date(parent, &work); + commit_list_insert_by_date(parent, &work); } } want->object.flags |= REACHABLE; diff --git a/walker.c b/walker.c index 11d9052ed..dce7128da 100644 --- a/walker.c +++ b/walker.c @@ -207,7 +207,7 @@ static int mark_complete(const char *path, const unsigned char *sha1, int flag, struct commit *commit = lookup_commit_reference_gently(sha1, 1); if (commit) { commit->object.flags |= COMPLETE; - insert_by_date(commit, &complete); + commit_list_insert_by_date(commit, &complete); } return 0; }