Merge branch 'rs/code-cleaning'
* rs/code-cleaning: remote-testsvn: use internal argv_array of struct child_process in cmd_import() bundle: use internal argv_array of struct child_process in create_bundle() fast-import: use hashcmp() for SHA1 hash comparison transport: simplify fetch_objs_via_rsync() using argv_array run-command: use internal argv_array of struct child_process in run_hook_ve() use commit_list_count() to count the members of commit_lists strbuf: use strbuf_addstr() for adding C strings
This commit is contained in:
@ -1371,11 +1371,8 @@ static struct commit_list *first_scapegoat(struct rev_info *revs, struct commit
|
||||
|
||||
static int num_scapegoats(struct rev_info *revs, struct commit *commit)
|
||||
{
|
||||
int cnt;
|
||||
struct commit_list *l = first_scapegoat(revs, commit);
|
||||
for (cnt = 0; l; l = l->next)
|
||||
cnt++;
|
||||
return cnt;
|
||||
return commit_list_count(l);
|
||||
}
|
||||
|
||||
/* Distribute collected unsorted blames to the respected sorted lists
|
||||
|
@ -702,7 +702,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
||||
char *buffer;
|
||||
buffer = strstr(use_message_buffer, "\n\n");
|
||||
if (buffer)
|
||||
strbuf_add(&sb, buffer + 2, strlen(buffer + 2));
|
||||
strbuf_addstr(&sb, buffer + 2);
|
||||
hook_arg1 = "commit";
|
||||
hook_arg2 = use_message;
|
||||
} else if (fixup_message) {
|
||||
|
@ -283,18 +283,6 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob
|
||||
}
|
||||
}
|
||||
|
||||
static int num_parents(struct commit *commit)
|
||||
{
|
||||
struct commit_list *parents;
|
||||
int i;
|
||||
|
||||
for (i = 0, parents = commit->parents;
|
||||
parents;
|
||||
parents = parents->next)
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
/* See grab_values */
|
||||
static void grab_commit_values(struct atom_value *val, int deref, struct object *obj, void *buf, unsigned long sz)
|
||||
{
|
||||
@ -315,12 +303,12 @@ static void grab_commit_values(struct atom_value *val, int deref, struct object
|
||||
}
|
||||
if (!strcmp(name, "numparent")) {
|
||||
char *s = xmalloc(40);
|
||||
v->ul = num_parents(commit);
|
||||
v->ul = commit_list_count(commit->parents);
|
||||
sprintf(s, "%lu", v->ul);
|
||||
v->s = s;
|
||||
}
|
||||
else if (!strcmp(name, "parent")) {
|
||||
int num = num_parents(commit);
|
||||
int num = commit_list_count(commit->parents);
|
||||
int i;
|
||||
struct commit_list *parents;
|
||||
char *s = xmalloc(41 * num + 1);
|
||||
|
Reference in New Issue
Block a user