Skip to content

Commit

Permalink
commit: Add commit_list prefix in two function names.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
tfarina authored and gitster committed Nov 29, 2010
1 parent 7d43de9 commit 47e44ed
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 35 deletions.
6 changes: 3 additions & 3 deletions builtin/describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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]);
Expand Down
4 changes: 2 additions & 2 deletions builtin/fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions builtin/show-branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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++)
Expand All @@ -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);
Expand Down
24 changes: 12 additions & 12 deletions commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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)) {
Expand All @@ -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;
Expand All @@ -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);
}
}

Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions commit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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++;
Expand Down
2 changes: 1 addition & 1 deletion sha1_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions upload-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion walker.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 47e44ed

Please sign in to comment.