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>maint
							parent
							
								
									e8c8b7139c
								
							
						
					
					
						commit
						1d2f80fa79
					
				|  | @ -38,8 +38,8 @@ struct string_list list; | ||||||
| int i; | int i; | ||||||
|  |  | ||||||
| memset(&list, 0, sizeof(struct string_list)); | memset(&list, 0, sizeof(struct string_list)); | ||||||
| string_list_append("foo", &list); | string_list_append(&list, "foo"); | ||||||
| string_list_append("bar", &list); | string_list_append(&list, "bar"); | ||||||
| for (i = 0; i < list.nr; i++) | for (i = 0; i < list.nr; i++) | ||||||
| 	printf("%s\n", list.items[i].string) | 	printf("%s\n", list.items[i].string) | ||||||
| ---- | ---- | ||||||
|  |  | ||||||
|  | @ -3394,7 +3394,7 @@ static void add_name_limit(const char *name, int exclude) | ||||||
| { | { | ||||||
| 	struct string_list_item *it; | 	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; | 	it->util = exclude ? NULL : (void *) 1; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @ -438,7 +438,7 @@ static void get_tags_and_duplicates(struct object_array *pending, | ||||||
| 			/* handle nested tags */ | 			/* handle nested tags */ | ||||||
| 			while (tag && tag->object.type == OBJ_TAG) { | 			while (tag && tag->object.type == OBJ_TAG) { | ||||||
| 				parse_object(tag->object.sha1); | 				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; | 				tag = (struct tag *)tag->tagged; | ||||||
| 			} | 			} | ||||||
| 			if (!tag) | 			if (!tag) | ||||||
|  | @ -464,7 +464,7 @@ static void get_tags_and_duplicates(struct object_array *pending, | ||||||
| 		} | 		} | ||||||
| 		if (commit->util) | 		if (commit->util) | ||||||
| 			/* more than one name for the same object */ | 			/* 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 | 		else | ||||||
| 			commit->util = full_name; | 			commit->util = full_name; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -745,7 +745,7 @@ static int get_one_remote_for_fetch(struct remote *remote, void *priv) | ||||||
| { | { | ||||||
| 	struct string_list *list = priv; | 	struct string_list *list = priv; | ||||||
| 	if (!remote->skip_default_update) | 	if (!remote->skip_default_update) | ||||||
| 		string_list_append(remote->name, list); | 		string_list_append(list, remote->name); | ||||||
| 	return 0; | 	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"); | 		int space = strcspn(value, " \t\n"); | ||||||
| 		while (*value) { | 		while (*value) { | ||||||
| 			if (space > 1) { | 			if (space > 1) { | ||||||
| 				string_list_append(xstrndup(value, space), | 				string_list_append(g->list, | ||||||
| 						   g->list); | 						   xstrndup(value, space)); | ||||||
| 			} | 			} | ||||||
| 			value += space + (value[space] != '\0'); | 			value += space + (value[space] != '\0'); | ||||||
| 			space = strcspn(value, " \t\n"); | 			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)) | 		if (!remote_is_configured(name)) | ||||||
| 			return 0; | 			return 0; | ||||||
| 		remote = remote_get(name); | 		remote = remote_get(name); | ||||||
| 		string_list_append(remote->name, list); | 		string_list_append(list, remote->name); | ||||||
| 	} | 	} | ||||||
| 	return 1; | 	return 1; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -82,7 +82,7 @@ static int handle_line(char *line) | ||||||
|  |  | ||||||
| 	item = unsorted_string_list_lookup(&srcs, src); | 	item = unsorted_string_list_lookup(&srcs, src); | ||||||
| 	if (!item) { | 	if (!item) { | ||||||
| 		item = string_list_append(src, &srcs); | 		item = string_list_append(&srcs, src); | ||||||
| 		item->util = xcalloc(1, sizeof(struct src_data)); | 		item->util = xcalloc(1, sizeof(struct src_data)); | ||||||
| 		init_src_data(item->util); | 		init_src_data(item->util); | ||||||
| 	} | 	} | ||||||
|  | @ -93,19 +93,19 @@ static int handle_line(char *line) | ||||||
| 		src_data->head_status |= 1; | 		src_data->head_status |= 1; | ||||||
| 	} else if (!prefixcmp(line, "branch ")) { | 	} else if (!prefixcmp(line, "branch ")) { | ||||||
| 		origin = line + 7; | 		origin = line + 7; | ||||||
| 		string_list_append(origin, &src_data->branch); | 		string_list_append(&src_data->branch, origin); | ||||||
| 		src_data->head_status |= 2; | 		src_data->head_status |= 2; | ||||||
| 	} else if (!prefixcmp(line, "tag ")) { | 	} else if (!prefixcmp(line, "tag ")) { | ||||||
| 		origin = line; | 		origin = line; | ||||||
| 		string_list_append(origin + 4, &src_data->tag); | 		string_list_append(&src_data->tag, origin + 4); | ||||||
| 		src_data->head_status |= 2; | 		src_data->head_status |= 2; | ||||||
| 	} else if (!prefixcmp(line, "remote branch ")) { | 	} else if (!prefixcmp(line, "remote branch ")) { | ||||||
| 		origin = line + 14; | 		origin = line + 14; | ||||||
| 		string_list_append(origin, &src_data->r_branch); | 		string_list_append(&src_data->r_branch, origin); | ||||||
| 		src_data->head_status |= 2; | 		src_data->head_status |= 2; | ||||||
| 	} else { | 	} else { | ||||||
| 		origin = src; | 		origin = src; | ||||||
| 		string_list_append(line, &src_data->generic); | 		string_list_append(&src_data->generic, line); | ||||||
| 		src_data->head_status |= 2; | 		src_data->head_status |= 2; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -118,7 +118,7 @@ static int handle_line(char *line) | ||||||
| 		sprintf(new_origin, "%s of %s", origin, src); | 		sprintf(new_origin, "%s of %s", origin, src); | ||||||
| 		origin = new_origin; | 		origin = new_origin; | ||||||
| 	} | 	} | ||||||
| 	string_list_append(origin, &origins)->util = sha1; | 	string_list_append(&origins, origin)->util = sha1; | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -176,10 +176,10 @@ static void shortlog(const char *name, unsigned char *sha1, | ||||||
| 		strbuf_ltrim(&sb); | 		strbuf_ltrim(&sb); | ||||||
|  |  | ||||||
| 		if (!sb.len) | 		if (!sb.len) | ||||||
| 			string_list_append(sha1_to_hex(commit->object.sha1), | 			string_list_append(&subjects, | ||||||
| 					   &subjects); | 					   sha1_to_hex(commit->object.sha1)); | ||||||
| 		else | 		else | ||||||
| 			string_list_append(strbuf_detach(&sb, NULL), &subjects); | 			string_list_append(&subjects, strbuf_detach(&sb, NULL)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (count > limit) | 	if (count > limit) | ||||||
|  |  | ||||||
|  | @ -535,13 +535,13 @@ static void add_header(const char *value) | ||||||
| 		len--; | 		len--; | ||||||
|  |  | ||||||
| 	if (!strncasecmp(value, "to: ", 4)) { | 	if (!strncasecmp(value, "to: ", 4)) { | ||||||
| 		item = string_list_append(value + 4, &extra_to); | 		item = string_list_append(&extra_to, value + 4); | ||||||
| 		len -= 4; | 		len -= 4; | ||||||
| 	} else if (!strncasecmp(value, "cc: ", 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; | 		len -= 4; | ||||||
| 	} else { | 	} else { | ||||||
| 		item = string_list_append(value, &extra_hdr); | 		item = string_list_append(&extra_hdr, value); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	item->string[len] = '\0'; | 	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 (!strcmp(var, "format.to")) { | ||||||
| 		if (!value) | 		if (!value) | ||||||
| 			return config_error_nonbool(var); | 			return config_error_nonbool(var); | ||||||
| 		string_list_append(value, &extra_to); | 		string_list_append(&extra_to, value); | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 	if (!strcmp(var, "format.cc")) { | 	if (!strcmp(var, "format.cc")) { | ||||||
| 		if (!value) | 		if (!value) | ||||||
| 			return config_error_nonbool(var); | 			return config_error_nonbool(var); | ||||||
| 		string_list_append(value, &extra_cc); | 		string_list_append(&extra_cc, value); | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 	if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) { | 	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) | 	if (unset) | ||||||
| 		string_list_clear(&extra_to, 0); | 		string_list_clear(&extra_to, 0); | ||||||
| 	else | 	else | ||||||
| 		string_list_append(arg, &extra_to); | 		string_list_append(&extra_to, arg); | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -958,7 +958,7 @@ static int cc_callback(const struct option *opt, const char *arg, int unset) | ||||||
| 	if (unset) | 	if (unset) | ||||||
| 		string_list_clear(&extra_cc, 0); | 		string_list_clear(&extra_cc, 0); | ||||||
| 	else | 	else | ||||||
| 		string_list_append(arg, &extra_cc); | 		string_list_append(&extra_cc, arg); | ||||||
| 	return 0; | 	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)); | 		rev.ref_message_ids = xcalloc(1, sizeof(struct string_list)); | ||||||
| 	if (in_reply_to) { | 	if (in_reply_to) { | ||||||
| 		const char *msgid = clean_message_id(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.numbered_files = numbered_files; | ||||||
| 	rev.patch_suffix = fmt_patch_suffix; | 	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)) | 				    && (!cover_letter || rev.nr > 1)) | ||||||
| 					free(rev.message_id); | 					free(rev.message_id); | ||||||
| 				else | 				else | ||||||
| 					string_list_append(rev.message_id, | 					string_list_append(rev.ref_message_ids, | ||||||
| 							   rev.ref_message_ids); | 							   rev.message_id); | ||||||
| 			} | 			} | ||||||
| 			gen_message_id(&rev, sha1_to_hex(commit->object.sha1)); | 			gen_message_id(&rev, sha1_to_hex(commit->object.sha1)); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -534,7 +534,7 @@ static void check_aliased_updates(struct command *commands) | ||||||
|  |  | ||||||
| 	for (cmd = commands; cmd; cmd = cmd->next) { | 	for (cmd = commands; cmd; cmd = cmd->next) { | ||||||
| 		struct string_list_item *item = | 		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; | 		item->util = (void *)cmd; | ||||||
| 	} | 	} | ||||||
| 	sort_string_list(&ref_list); | 	sort_string_list(&ref_list); | ||||||
|  |  | ||||||
|  | @ -87,7 +87,7 @@ static int opt_parse_track(const struct option *opt, const char *arg, int not) | ||||||
| 	if (not) | 	if (not) | ||||||
| 		string_list_clear(list, 0); | 		string_list_clear(list, 0); | ||||||
| 	else | 	else | ||||||
| 		string_list_append(arg, list); | 		string_list_append(list, arg); | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -160,7 +160,7 @@ static int add(int argc, const char **argv) | ||||||
| 	strbuf_addf(&buf, "remote.%s.fetch", name); | 	strbuf_addf(&buf, "remote.%s.fetch", name); | ||||||
|  |  | ||||||
| 	if (track.nr == 0) | 	if (track.nr == 0) | ||||||
| 		string_list_append("*", &track); | 		string_list_append(&track, "*"); | ||||||
| 	for (i = 0; i < track.nr; i++) { | 	for (i = 0; i < track.nr; i++) { | ||||||
| 		struct string_list_item *item = track.items + 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) { | 			while (space) { | ||||||
| 				char *merge; | 				char *merge; | ||||||
| 				merge = xstrndup(value, space - value); | 				merge = xstrndup(value, space - value); | ||||||
| 				string_list_append(merge, &info->merge); | 				string_list_append(&info->merge, merge); | ||||||
| 				value = abbrev_branch(space + 1); | 				value = abbrev_branch(space + 1); | ||||||
| 				space = strchr(value, ' '); | 				space = strchr(value, ' '); | ||||||
| 			} | 			} | ||||||
| 			string_list_append(xstrdup(value), &info->merge); | 			string_list_append(&info->merge, xstrdup(value)); | ||||||
| 		} else | 		} else | ||||||
| 			info->rebase = git_config_bool(orig_key, value); | 			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) { | 	for (ref = fetch_map; ref; ref = ref->next) { | ||||||
| 		unsigned char sha1[20]; | 		unsigned char sha1[20]; | ||||||
| 		if (!ref->peer_ref || read_ref(ref->peer_ref->name, sha1)) | 		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 | 		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); | 	stale_refs = get_stale_heads(states->remote, fetch_map); | ||||||
| 	for (ref = stale_refs; ref; ref = ref->next) { | 	for (ref = stale_refs; ref; ref = ref->next) { | ||||||
| 		struct string_list_item *item = | 		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); | 		item->util = xstrdup(ref->name); | ||||||
| 	} | 	} | ||||||
| 	free_refs(stale_refs); | 	free_refs(stale_refs); | ||||||
|  | @ -363,8 +363,8 @@ static int get_push_ref_states(const struct ref *remote_refs, | ||||||
| 			continue; | 			continue; | ||||||
| 		hashcpy(ref->new_sha1, ref->peer_ref->new_sha1); | 		hashcpy(ref->new_sha1, ref->peer_ref->new_sha1); | ||||||
|  |  | ||||||
| 		item = string_list_append(abbrev_branch(ref->peer_ref->name), | 		item = string_list_append(&states->push, | ||||||
| 					  &states->push); | 					  abbrev_branch(ref->peer_ref->name)); | ||||||
| 		item->util = xcalloc(sizeof(struct push_info), 1); | 		item->util = xcalloc(sizeof(struct push_info), 1); | ||||||
| 		info = item->util; | 		info = item->util; | ||||||
| 		info->forced = ref->force; | 		info->forced = ref->force; | ||||||
|  | @ -399,7 +399,7 @@ static int get_push_ref_states_noquery(struct ref_states *states) | ||||||
|  |  | ||||||
| 	states->push.strdup_strings = 1; | 	states->push.strdup_strings = 1; | ||||||
| 	if (!remote->push_refspec_nr) { | 	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 = item->util = xcalloc(sizeof(struct push_info), 1); | ||||||
| 		info->status = PUSH_STATUS_NOTQUERIED; | 		info->status = PUSH_STATUS_NOTQUERIED; | ||||||
| 		info->dest = xstrdup(item->string); | 		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++) { | 	for (i = 0; i < remote->push_refspec_nr; i++) { | ||||||
| 		struct refspec *spec = remote->push + i; | 		struct refspec *spec = remote->push + i; | ||||||
| 		if (spec->matching) | 		if (spec->matching) | ||||||
| 			item = string_list_append("(matching)", &states->push); | 			item = string_list_append(&states->push, "(matching)"); | ||||||
| 		else if (strlen(spec->src)) | 		else if (strlen(spec->src)) | ||||||
| 			item = string_list_append(spec->src, &states->push); | 			item = string_list_append(&states->push, spec->src); | ||||||
| 		else | 		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 = item->util = xcalloc(sizeof(struct push_info), 1); | ||||||
| 		info->forced = spec->force; | 		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"), | 	matches = guess_remote_head(find_ref_by_name(remote_refs, "HEAD"), | ||||||
| 				    fetch_map, 1); | 				    fetch_map, 1); | ||||||
| 	for (ref = matches; ref; ref = ref->next) | 	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(fetch_map); | ||||||
| 	free_refs(matches); | 	free_refs(matches); | ||||||
|  | @ -499,8 +499,8 @@ static int add_branch_for_removal(const char *refname, | ||||||
| 	if (prefixcmp(refname, "refs/remotes")) { | 	if (prefixcmp(refname, "refs/remotes")) { | ||||||
| 		/* advise user how to delete local branches */ | 		/* advise user how to delete local branches */ | ||||||
| 		if (!prefixcmp(refname, "refs/heads/")) | 		if (!prefixcmp(refname, "refs/heads/")) | ||||||
| 			string_list_append(abbrev_branch(refname), | 			string_list_append(branches->skipped, | ||||||
| 					   branches->skipped); | 					   abbrev_branch(refname)); | ||||||
| 		/* silently skip over other non-remote refs */ | 		/* silently skip over other non-remote refs */ | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
|  | @ -509,7 +509,7 @@ static int add_branch_for_removal(const char *refname, | ||||||
| 	if (flags & REF_ISSYMREF) | 	if (flags & REF_ISSYMREF) | ||||||
| 		return unlink(git_path("%s", refname)); | 		return unlink(git_path("%s", refname)); | ||||||
|  |  | ||||||
| 	item = string_list_append(refname, branches->branches); | 	item = string_list_append(branches->branches, refname); | ||||||
| 	item->util = xmalloc(20); | 	item->util = xmalloc(20); | ||||||
| 	hashcpy(item->util, sha1); | 	hashcpy(item->util, sha1); | ||||||
|  |  | ||||||
|  | @ -534,7 +534,7 @@ static int read_remote_branches(const char *refname, | ||||||
|  |  | ||||||
| 	strbuf_addf(&buf, "refs/remotes/%s", rename->old); | 	strbuf_addf(&buf, "refs/remotes/%s", rename->old); | ||||||
| 	if (!prefixcmp(refname, buf.buf)) { | 	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); | 		symref = resolve_ref(refname, orig_sha1, 1, &flag); | ||||||
| 		if (flag & REF_ISSYMREF) | 		if (flag & REF_ISSYMREF) | ||||||
| 			item->util = xstrdup(symref); | 			item->util = xstrdup(symref); | ||||||
|  | @ -817,7 +817,7 @@ static int append_ref_to_tracked_list(const char *refname, | ||||||
| 	memset(&refspec, 0, sizeof(refspec)); | 	memset(&refspec, 0, sizeof(refspec)); | ||||||
| 	refspec.dst = (char *)refname; | 	refspec.dst = (char *)refname; | ||||||
| 	if (!remote_find_tracking(states->remote, &refspec)) | 	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; | 	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; | 		show_info->width = n; | ||||||
| 	if ((n = strlen(push_info->dest)) > show_info->width2) | 	if ((n = strlen(push_info->dest)) > show_info->width2) | ||||||
| 		show_info->width2 = n; | 		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; | 	item->util = push_item->util; | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | @ -1379,10 +1379,10 @@ static int get_one_entry(struct remote *remote, void *priv) | ||||||
|  |  | ||||||
| 	if (remote->url_nr > 0) { | 	if (remote->url_nr > 0) { | ||||||
| 		strbuf_addf(&url_buf, "%s (fetch)", remote->url[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); | 				strbuf_detach(&url_buf, NULL); | ||||||
| 	} else | 	} else | ||||||
| 		string_list_append(remote->name, list)->util = NULL; | 		string_list_append(list, remote->name)->util = NULL; | ||||||
| 	if (remote->pushurl_nr) { | 	if (remote->pushurl_nr) { | ||||||
| 		url = remote->pushurl; | 		url = remote->pushurl; | ||||||
| 		url_nr = remote->pushurl_nr; | 		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++) | 	for (i = 0; i < url_nr; i++) | ||||||
| 	{ | 	{ | ||||||
| 		strbuf_addf(&url_buf, "%s (push)", url[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); | 				strbuf_detach(&url_buf, NULL); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @ -59,7 +59,7 @@ static void garbage_collect(struct string_list *rr) | ||||||
| 		cutoff = (has_rerere_resolution(e->d_name) | 		cutoff = (has_rerere_resolution(e->d_name) | ||||||
| 			  ? cutoff_resolve : cutoff_noresolve); | 			  ? cutoff_resolve : cutoff_noresolve); | ||||||
| 		if (then < now - cutoff * 86400) | 		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++) | 	for (i = 0; i < to_remove.nr; i++) | ||||||
| 		unlink_rr_item(to_remove.items[i].string); | 		unlink_rr_item(to_remove.items[i].string); | ||||||
|  |  | ||||||
|  | @ -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) | static void read_from_stdin(struct shortlog *log) | ||||||
|  |  | ||||||
							
								
								
									
										6
									
								
								notes.c
								
								
								
								
							
							
						
						
									
										6
									
								
								notes.c
								
								
								
								
							|  | @ -838,7 +838,7 @@ static int string_list_add_one_ref(const char *path, const unsigned char *sha1, | ||||||
| { | { | ||||||
| 	struct string_list *refs = cb; | 	struct string_list *refs = cb; | ||||||
| 	if (!unsorted_string_list_has_string(refs, path)) | 	if (!unsorted_string_list_has_string(refs, path)) | ||||||
| 		string_list_append(path, refs); | 		string_list_append(refs, path); | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -851,7 +851,7 @@ void string_list_add_refs_by_glob(struct string_list *list, const char *glob) | ||||||
| 		if (get_sha1(glob, sha1)) | 		if (get_sha1(glob, sha1)) | ||||||
| 			warning("notes ref %s is invalid", glob); | 			warning("notes ref %s is invalid", glob); | ||||||
| 		if (!unsorted_string_list_has_string(list, glob)) | 		if (!unsorted_string_list_has_string(list, glob)) | ||||||
| 			string_list_append(glob, list); | 			string_list_append(list, glob); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -983,7 +983,7 @@ void init_display_notes(struct display_notes_opt *opt) | ||||||
| 	assert(!display_notes_trees); | 	assert(!display_notes_trees); | ||||||
|  |  | ||||||
| 	if (!opt || !opt->suppress_default_notes) { | 	if (!opt || !opt->suppress_default_notes) { | ||||||
| 		string_list_append(default_notes_ref(), &display_notes_refs); | 		string_list_append(&display_notes_refs, default_notes_ref()); | ||||||
| 		display_ref_env = getenv(GIT_NOTES_DISPLAY_REF_ENVIRONMENT); | 		display_ref_env = getenv(GIT_NOTES_DISPLAY_REF_ENVIRONMENT); | ||||||
| 		if (display_ref_env) { | 		if (display_ref_env) { | ||||||
| 			string_list_add_refs_from_colon_sep(&display_notes_refs, | 			string_list_add_refs_from_colon_sep(&display_notes_refs, | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								remote.c
								
								
								
								
							
							
						
						
									
										2
									
								
								remote.c
								
								
								
								
							|  | @ -1711,7 +1711,7 @@ struct ref *get_stale_heads(struct remote *remote, struct ref *fetch_map) | ||||||
| 	info.ref_names = &ref_names; | 	info.ref_names = &ref_names; | ||||||
| 	info.stale_refs_tail = &stale_refs; | 	info.stale_refs_tail = &stale_refs; | ||||||
| 	for (ref = fetch_map; ref; ref = ref->next) | 	for (ref = fetch_map; ref; ref = ref->next) | ||||||
| 		string_list_append(ref->name, &ref_names); | 		string_list_append(&ref_names, ref->name); | ||||||
| 	sort_string_list(&ref_names); | 	sort_string_list(&ref_names); | ||||||
| 	for_each_ref(get_stale_heads_cb, &info); | 	for_each_ref(get_stale_heads_cb, &info); | ||||||
| 	string_list_clear(&ref_names, 0); | 	string_list_clear(&ref_names, 0); | ||||||
|  |  | ||||||
|  | @ -1205,8 +1205,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg | ||||||
| 		else | 		else | ||||||
| 			strbuf_addstr(&buf, "refs/notes/"); | 			strbuf_addstr(&buf, "refs/notes/"); | ||||||
| 		strbuf_addstr(&buf, arg+13); | 		strbuf_addstr(&buf, arg+13); | ||||||
| 		string_list_append(strbuf_detach(&buf, NULL), | 		string_list_append(revs->notes_opt.extra_notes_refs, | ||||||
| 				   revs->notes_opt.extra_notes_refs); | 				   strbuf_detach(&buf, NULL)); | ||||||
| 	} else if (!strcmp(arg, "--no-notes")) { | 	} else if (!strcmp(arg, "--no-notes")) { | ||||||
| 		revs->show_notes = 0; | 		revs->show_notes = 0; | ||||||
| 		revs->show_notes_given = 1; | 		revs->show_notes_given = 1; | ||||||
|  |  | ||||||
|  | @ -148,7 +148,7 @@ void print_string_list(const struct string_list *p, const char *text) | ||||||
| 		printf("%s:%p\n", p->items[i].string, p->items[i].util); | 		printf("%s:%p\n", p->items[i].string, p->items[i].util); | ||||||
| } | } | ||||||
|  |  | ||||||
| struct string_list_item *string_list_append(const char *string, struct string_list *list) | struct string_list_item *string_list_append(struct string_list *list, const char *string) | ||||||
| { | { | ||||||
| 	ALLOC_GROW(list->items, list->nr + 1, list->alloc); | 	ALLOC_GROW(list->items, list->nr + 1, list->alloc); | ||||||
| 	list->items[list->nr].string = | 	list->items[list->nr].string = | ||||||
|  |  | ||||||
|  | @ -35,7 +35,7 @@ struct string_list_item *string_list_insert_at_index(struct string_list *list, | ||||||
| struct string_list_item *string_list_lookup(struct string_list *list, const char *string); | struct string_list_item *string_list_lookup(struct string_list *list, const char *string); | ||||||
|  |  | ||||||
| /* Use these functions only on unsorted lists: */ | /* Use these functions only on unsorted lists: */ | ||||||
| struct string_list_item *string_list_append(const char *string, struct string_list *list); | struct string_list_item *string_list_append(struct string_list *list, const char *string); | ||||||
| void sort_string_list(struct string_list *list); | void sort_string_list(struct string_list *list); | ||||||
| int unsorted_string_list_has_string(struct string_list *list, const char *string); | int unsorted_string_list_has_string(struct string_list *list, const char *string); | ||||||
| struct string_list_item *unsorted_string_list_lookup(struct string_list *list, | struct string_list_item *unsorted_string_list_lookup(struct string_list *list, | ||||||
|  |  | ||||||
|  | @ -727,10 +727,10 @@ static int push_refs_with_export(struct transport *transport, | ||||||
| 		private = apply_refspecs(data->refspecs, data->refspec_nr, ref->name); | 		private = apply_refspecs(data->refspecs, data->refspec_nr, ref->name); | ||||||
| 		if (private && !get_sha1(private, sha1)) { | 		if (private && !get_sha1(private, sha1)) { | ||||||
| 			strbuf_addf(&buf, "^%s", private); | 			strbuf_addf(&buf, "^%s", private); | ||||||
| 			string_list_append(strbuf_detach(&buf, NULL), &revlist_args); | 			string_list_append(&revlist_args, strbuf_detach(&buf, NULL)); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		string_list_append(ref->name, &revlist_args); | 		string_list_append(&revlist_args, ref->name); | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Julian Phillips
						Julian Phillips