diff options
author | Julian Phillips <julian@quantumfyre.co.uk> | 2010-06-26 00:41:38 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-06-27 10:06:52 -0700 |
commit | 1d2f80fa79cdc6f7f4fa1cefb47d7d19be3bc5ee (patch) | |
tree | ddad96762347505bb9b455b2e891f74b0b320f99 /builtin | |
parent | e8c8b7139c87c3e3017d3bff07f91c4349850d58 (diff) | |
download | git-1d2f80fa79cdc6f7f4fa1cefb47d7d19be3bc5ee.tar.gz git-1d2f80fa79cdc6f7f4fa1cefb47d7d19be3bc5ee.tar.xz |
string_list: Fix argument order for string_list_append
Update the definition and callers of string_list_append to use the
string_list as the first argument. This helps make the string_list
API easier to use by being more consistent.
Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/apply.c | 2 | ||||
-rw-r--r-- | builtin/fast-export.c | 4 | ||||
-rw-r--r-- | builtin/fetch.c | 8 | ||||
-rw-r--r-- | builtin/fmt-merge-msg.c | 18 | ||||
-rw-r--r-- | builtin/log.c | 20 | ||||
-rw-r--r-- | builtin/receive-pack.c | 2 | ||||
-rw-r--r-- | builtin/remote.c | 46 | ||||
-rw-r--r-- | builtin/rerere.c | 2 | ||||
-rw-r--r-- | builtin/shortlog.c | 2 |
9 files changed, 52 insertions, 52 deletions
diff --git a/builtin/apply.c b/builtin/apply.c index cf92f12a1..03639282e 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -3394,7 +3394,7 @@ static void add_name_limit(const char *name, int exclude) { struct string_list_item *it; - it = string_list_append(name, &limit_by_name); + it = string_list_append(&limit_by_name, name); it->util = exclude ? NULL : (void *) 1; } diff --git a/builtin/fast-export.c b/builtin/fast-export.c index c6dd71a7b..9fe25ff0b 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -438,7 +438,7 @@ static void get_tags_and_duplicates(struct object_array *pending, /* handle nested tags */ while (tag && tag->object.type == OBJ_TAG) { parse_object(tag->object.sha1); - string_list_append(full_name, extra_refs)->util = tag; + string_list_append(extra_refs, full_name)->util = tag; tag = (struct tag *)tag->tagged; } if (!tag) @@ -464,7 +464,7 @@ static void get_tags_and_duplicates(struct object_array *pending, } if (commit->util) /* more than one name for the same object */ - string_list_append(full_name, extra_refs)->util = commit; + string_list_append(extra_refs, full_name)->util = commit; else commit->util = full_name; } diff --git a/builtin/fetch.c b/builtin/fetch.c index 9165bb605..c5e24b50e 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -745,7 +745,7 @@ static int get_one_remote_for_fetch(struct remote *remote, void *priv) { struct string_list *list = priv; if (!remote->skip_default_update) - string_list_append(remote->name, list); + string_list_append(list, remote->name); return 0; } @@ -764,8 +764,8 @@ static int get_remote_group(const char *key, const char *value, void *priv) int space = strcspn(value, " \t\n"); while (*value) { if (space > 1) { - string_list_append(xstrndup(value, space), - g->list); + string_list_append(g->list, + xstrndup(value, space)); } value += space + (value[space] != '\0'); space = strcspn(value, " \t\n"); @@ -786,7 +786,7 @@ static int add_remote_or_group(const char *name, struct string_list *list) if (!remote_is_configured(name)) return 0; remote = remote_get(name); - string_list_append(remote->name, list); + string_list_append(list, remote->name); } return 1; } diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index 379a03131..601201264 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -82,7 +82,7 @@ static int handle_line(char *line) item = unsorted_string_list_lookup(&srcs, src); if (!item) { - item = string_list_append(src, &srcs); + item = string_list_append(&srcs, src); item->util = xcalloc(1, sizeof(struct src_data)); init_src_data(item->util); } @@ -93,19 +93,19 @@ static int handle_line(char *line) src_data->head_status |= 1; } else if (!prefixcmp(line, "branch ")) { origin = line + 7; - string_list_append(origin, &src_data->branch); + string_list_append(&src_data->branch, origin); src_data->head_status |= 2; } else if (!prefixcmp(line, "tag ")) { origin = line; - string_list_append(origin + 4, &src_data->tag); + string_list_append(&src_data->tag, origin + 4); src_data->head_status |= 2; } else if (!prefixcmp(line, "remote branch ")) { origin = line + 14; - string_list_append(origin, &src_data->r_branch); + string_list_append(&src_data->r_branch, origin); src_data->head_status |= 2; } else { origin = src; - string_list_append(line, &src_data->generic); + string_list_append(&src_data->generic, line); src_data->head_status |= 2; } @@ -118,7 +118,7 @@ static int handle_line(char *line) sprintf(new_origin, "%s of %s", origin, src); origin = new_origin; } - string_list_append(origin, &origins)->util = sha1; + string_list_append(&origins, origin)->util = sha1; return 0; } @@ -176,10 +176,10 @@ static void shortlog(const char *name, unsigned char *sha1, strbuf_ltrim(&sb); if (!sb.len) - string_list_append(sha1_to_hex(commit->object.sha1), - &subjects); + string_list_append(&subjects, + sha1_to_hex(commit->object.sha1)); else - string_list_append(strbuf_detach(&sb, NULL), &subjects); + string_list_append(&subjects, strbuf_detach(&sb, NULL)); } if (count > limit) diff --git a/builtin/log.c b/builtin/log.c index 976e16f9f..40bdd01e8 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -535,13 +535,13 @@ static void add_header(const char *value) len--; if (!strncasecmp(value, "to: ", 4)) { - item = string_list_append(value + 4, &extra_to); + item = string_list_append(&extra_to, value + 4); len -= 4; } else if (!strncasecmp(value, "cc: ", 4)) { - item = string_list_append(value + 4, &extra_cc); + item = string_list_append(&extra_cc, value + 4); len -= 4; } else { - item = string_list_append(value, &extra_hdr); + item = string_list_append(&extra_hdr, value); } item->string[len] = '\0'; @@ -565,13 +565,13 @@ static int git_format_config(const char *var, const char *value, void *cb) if (!strcmp(var, "format.to")) { if (!value) return config_error_nonbool(var); - string_list_append(value, &extra_to); + string_list_append(&extra_to, value); return 0; } if (!strcmp(var, "format.cc")) { if (!value) return config_error_nonbool(var); - string_list_append(value, &extra_cc); + string_list_append(&extra_cc, value); return 0; } if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) { @@ -949,7 +949,7 @@ static int to_callback(const struct option *opt, const char *arg, int unset) if (unset) string_list_clear(&extra_to, 0); else - string_list_append(arg, &extra_to); + string_list_append(&extra_to, arg); return 0; } @@ -958,7 +958,7 @@ static int cc_callback(const struct option *opt, const char *arg, int unset) if (unset) string_list_clear(&extra_cc, 0); else - string_list_append(arg, &extra_cc); + string_list_append(&extra_cc, arg); return 0; } @@ -1239,7 +1239,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) rev.ref_message_ids = xcalloc(1, sizeof(struct string_list)); if (in_reply_to) { const char *msgid = clean_message_id(in_reply_to); - string_list_append(msgid, rev.ref_message_ids); + string_list_append(rev.ref_message_ids, msgid); } rev.numbered_files = numbered_files; rev.patch_suffix = fmt_patch_suffix; @@ -1286,8 +1286,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) && (!cover_letter || rev.nr > 1)) free(rev.message_id); else - string_list_append(rev.message_id, - rev.ref_message_ids); + string_list_append(rev.ref_message_ids, + rev.message_id); } gen_message_id(&rev, sha1_to_hex(commit->object.sha1)); } diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 8b5a4656e..5170abf2a 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -534,7 +534,7 @@ static void check_aliased_updates(struct command *commands) for (cmd = commands; cmd; cmd = cmd->next) { struct string_list_item *item = - string_list_append(cmd->ref_name, &ref_list); + string_list_append(&ref_list, cmd->ref_name); item->util = (void *)cmd; } sort_string_list(&ref_list); diff --git a/builtin/remote.c b/builtin/remote.c index 7e9299cfc..03d90cde0 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -87,7 +87,7 @@ static int opt_parse_track(const struct option *opt, const char *arg, int not) if (not) string_list_clear(list, 0); else - string_list_append(arg, list); + string_list_append(list, arg); return 0; } @@ -160,7 +160,7 @@ static int add(int argc, const char **argv) strbuf_addf(&buf, "remote.%s.fetch", name); if (track.nr == 0) - string_list_append("*", &track); + string_list_append(&track, "*"); for (i = 0; i < track.nr; i++) { struct string_list_item *item = track.items + i; @@ -266,11 +266,11 @@ static int config_read_branches(const char *key, const char *value, void *cb) while (space) { char *merge; merge = xstrndup(value, space - value); - string_list_append(merge, &info->merge); + string_list_append(&info->merge, merge); value = abbrev_branch(space + 1); space = strchr(value, ' '); } - string_list_append(xstrdup(value), &info->merge); + string_list_append(&info->merge, xstrdup(value)); } else info->rebase = git_config_bool(orig_key, value); } @@ -307,14 +307,14 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat for (ref = fetch_map; ref; ref = ref->next) { unsigned char sha1[20]; if (!ref->peer_ref || read_ref(ref->peer_ref->name, sha1)) - string_list_append(abbrev_branch(ref->name), &states->new); + string_list_append(&states->new, abbrev_branch(ref->name)); else - string_list_append(abbrev_branch(ref->name), &states->tracked); + string_list_append(&states->tracked, abbrev_branch(ref->name)); } stale_refs = get_stale_heads(states->remote, fetch_map); for (ref = stale_refs; ref; ref = ref->next) { struct string_list_item *item = - string_list_append(abbrev_branch(ref->name), &states->stale); + string_list_append(&states->stale, abbrev_branch(ref->name)); item->util = xstrdup(ref->name); } free_refs(stale_refs); @@ -363,8 +363,8 @@ static int get_push_ref_states(const struct ref *remote_refs, continue; hashcpy(ref->new_sha1, ref->peer_ref->new_sha1); - item = string_list_append(abbrev_branch(ref->peer_ref->name), - &states->push); + item = string_list_append(&states->push, + abbrev_branch(ref->peer_ref->name)); item->util = xcalloc(sizeof(struct push_info), 1); info = item->util; info->forced = ref->force; @@ -399,7 +399,7 @@ static int get_push_ref_states_noquery(struct ref_states *states) states->push.strdup_strings = 1; if (!remote->push_refspec_nr) { - item = string_list_append("(matching)", &states->push); + item = string_list_append(&states->push, "(matching)"); info = item->util = xcalloc(sizeof(struct push_info), 1); info->status = PUSH_STATUS_NOTQUERIED; info->dest = xstrdup(item->string); @@ -407,11 +407,11 @@ static int get_push_ref_states_noquery(struct ref_states *states) for (i = 0; i < remote->push_refspec_nr; i++) { struct refspec *spec = remote->push + i; if (spec->matching) - item = string_list_append("(matching)", &states->push); + item = string_list_append(&states->push, "(matching)"); else if (strlen(spec->src)) - item = string_list_append(spec->src, &states->push); + item = string_list_append(&states->push, spec->src); else - item = string_list_append("(delete)", &states->push); + item = string_list_append(&states->push, "(delete)"); info = item->util = xcalloc(sizeof(struct push_info), 1); info->forced = spec->force; @@ -435,7 +435,7 @@ static int get_head_names(const struct ref *remote_refs, struct ref_states *stat matches = guess_remote_head(find_ref_by_name(remote_refs, "HEAD"), fetch_map, 1); for (ref = matches; ref; ref = ref->next) - string_list_append(abbrev_branch(ref->name), &states->heads); + string_list_append(&states->heads, abbrev_branch(ref->name)); free_refs(fetch_map); free_refs(matches); @@ -499,8 +499,8 @@ static int add_branch_for_removal(const char *refname, if (prefixcmp(refname, "refs/remotes")) { /* advise user how to delete local branches */ if (!prefixcmp(refname, "refs/heads/")) - string_list_append(abbrev_branch(refname), - branches->skipped); + string_list_append(branches->skipped, + abbrev_branch(refname)); /* silently skip over other non-remote refs */ return 0; } @@ -509,7 +509,7 @@ static int add_branch_for_removal(const char *refname, if (flags & REF_ISSYMREF) return unlink(git_path("%s", refname)); - item = string_list_append(refname, branches->branches); + item = string_list_append(branches->branches, refname); item->util = xmalloc(20); hashcpy(item->util, sha1); @@ -534,7 +534,7 @@ static int read_remote_branches(const char *refname, strbuf_addf(&buf, "refs/remotes/%s", rename->old); if (!prefixcmp(refname, buf.buf)) { - item = string_list_append(xstrdup(refname), rename->remote_branches); + item = string_list_append(rename->remote_branches, xstrdup(refname)); symref = resolve_ref(refname, orig_sha1, 1, &flag); if (flag & REF_ISSYMREF) item->util = xstrdup(symref); @@ -817,7 +817,7 @@ static int append_ref_to_tracked_list(const char *refname, memset(&refspec, 0, sizeof(refspec)); refspec.dst = (char *)refname; if (!remote_find_tracking(states->remote, &refspec)) - string_list_append(abbrev_branch(refspec.src), &states->tracked); + string_list_append(&states->tracked, abbrev_branch(refspec.src)); return 0; } @@ -965,7 +965,7 @@ static int add_push_to_show_info(struct string_list_item *push_item, void *cb_da show_info->width = n; if ((n = strlen(push_info->dest)) > show_info->width2) show_info->width2 = n; - item = string_list_append(push_item->string, show_info->list); + item = string_list_append(show_info->list, push_item->string); item->util = push_item->util; return 0; } @@ -1379,10 +1379,10 @@ static int get_one_entry(struct remote *remote, void *priv) if (remote->url_nr > 0) { strbuf_addf(&url_buf, "%s (fetch)", remote->url[0]); - string_list_append(remote->name, list)->util = + string_list_append(list, remote->name)->util = strbuf_detach(&url_buf, NULL); } else - string_list_append(remote->name, list)->util = NULL; + string_list_append(list, remote->name)->util = NULL; if (remote->pushurl_nr) { url = remote->pushurl; url_nr = remote->pushurl_nr; @@ -1393,7 +1393,7 @@ static int get_one_entry(struct remote *remote, void *priv) for (i = 0; i < url_nr; i++) { strbuf_addf(&url_buf, "%s (push)", url[i]); - string_list_append(remote->name, list)->util = + string_list_append(list, remote->name)->util = strbuf_detach(&url_buf, NULL); } diff --git a/builtin/rerere.c b/builtin/rerere.c index 34f9acee9..73610b6bc 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -59,7 +59,7 @@ static void garbage_collect(struct string_list *rr) cutoff = (has_rerere_resolution(e->d_name) ? cutoff_resolve : cutoff_noresolve); if (then < now - cutoff * 86400) - string_list_append(e->d_name, &to_remove); + string_list_append(&to_remove, e->d_name); } for (i = 0; i < to_remove.nr; i++) unlink_rr_item(to_remove.items[i].string); diff --git a/builtin/shortlog.c b/builtin/shortlog.c index 86d32fb7f..0a9681ba7 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -115,7 +115,7 @@ static void insert_one_record(struct shortlog *log, } } - string_list_append(buffer, item->util); + string_list_append(item->util, buffer); } static void read_from_stdin(struct shortlog *log) |