summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aadceea)
raw | patch | inline | side by side (parent: aadceea)
author | Julian Phillips <julian@quantumfyre.co.uk> | |
Fri, 25 Jun 2010 23:41:37 +0000 (00:41 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 27 Jun 2010 17:06:51 +0000 (10:06 -0700) |
Update the definition and callers of string_list_lookup 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>
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>
builtin/apply.c | patch | blob | history | |
builtin/fetch.c | patch | blob | history | |
builtin/receive-pack.c | patch | blob | history | |
http-backend.c | patch | blob | history | |
mailmap.c | patch | blob | history | |
merge-recursive.c | patch | blob | history | |
reflog-walk.c | patch | blob | history | |
remote.c | patch | blob | history | |
resolve-undo.c | patch | blob | history | |
string-list.c | patch | blob | history | |
string-list.h | patch | blob | history |
diff --git a/builtin/apply.c b/builtin/apply.c
index 57151225fe9b1cb55678597e3bc8b5c5b706e659..cf92f12a1bfd6e84dcdf60bb397587e6c7e3df8d 100644 (file)
--- a/builtin/apply.c
+++ b/builtin/apply.c
if (name == NULL)
return NULL;
- item = string_list_lookup(name, &fn_table);
+ item = string_list_lookup(&fn_table, name);
if (item != NULL)
return (struct patch *)item->util;
diff --git a/builtin/fetch.c b/builtin/fetch.c
index e4296ab3bd1771e730a2955651163037f65fa6de..9165bb6052f95fd127e7c2911a0f58b5281211c5 100644 (file)
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
for (rm = ref_map; rm; rm = rm->next) {
if (rm->peer_ref) {
- peer_item = string_list_lookup(rm->peer_ref->name,
- &existing_refs);
+ peer_item = string_list_lookup(&existing_refs,
+ rm->peer_ref->name);
if (peer_item)
hashcpy(rm->peer_ref->old_sha1,
peer_item->util);
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index bb34757d27f32fff8cb15a8f99d8295b5e38cb9e..8b5a4656ec6143436e1f1a6f1d589b1ee6d73001 100644 (file)
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
if (!(flag & REF_ISSYMREF))
return;
- if ((item = string_list_lookup(dst_name, list)) == NULL)
+ if ((item = string_list_lookup(list, dst_name)) == NULL)
return;
cmd->skip_update = 1;
diff --git a/http-backend.c b/http-backend.c
index 0e7af4eebb277feb45e4ecbbd3facc7dac395c53..8ec15f99c05cbdcc432cce95bdf1b6a45347368d 100644 (file)
--- a/http-backend.c
+++ b/http-backend.c
char *value = decode_parameter(&query, 0);
struct string_list_item *i;
- i = string_list_lookup(name, query_params);
+ i = string_list_lookup(query_params, name);
if (!i)
i = string_list_insert(query_params, name);
else
static const char *get_parameter(const char *name)
{
struct string_list_item *i;
- i = string_list_lookup(name, get_parameters());
+ i = string_list_lookup(get_parameters(), name);
return i ? i->util : NULL;
}
diff --git a/mailmap.c b/mailmap.c
index 8b6dc36bbc54bf8c4606ad9ecf03b8cdcc8f9dac..f80b701292f0d852950735ab20a63dac13e92362 100644 (file)
--- a/mailmap.c
+++ b/mailmap.c
mailbuf[i] = 0;
debug_mm("map_user: map '%s' <%s>\n", name, mailbuf);
- item = string_list_lookup(mailbuf, map);
+ item = string_list_lookup(map, mailbuf);
if (item != NULL) {
me = (struct mailmap_entry *)item->util;
if (me->namemap.nr) {
/* The item has multiple items, so we'll look up on name too */
/* If the name is not found, we choose the simple entry */
- struct string_list_item *subitem = string_list_lookup(name, &me->namemap);
+ struct string_list_item *subitem = string_list_lookup(&me->namemap, name);
if (subitem)
item = subitem;
}
diff --git a/merge-recursive.c b/merge-recursive.c
index 5e60f4ba224b6c49bb7434023a8f7ac73297d7c5..856e98c0837f422f18d57aa4f3ca453120882bca 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
if (!ce_stage(ce))
continue;
- item = string_list_lookup(ce->name, unmerged);
+ item = string_list_lookup(unmerged, ce->name);
if (!item) {
item = string_list_insert(unmerged, ce->name);
item->util = xcalloc(1, sizeof(struct stage_data));
re = xmalloc(sizeof(*re));
re->processed = 0;
re->pair = pair;
- item = string_list_lookup(re->pair->one->path, entries);
+ item = string_list_lookup(entries, re->pair->one->path);
if (!item)
re->src_entry = insert_stage_data(re->pair->one->path,
o_tree, a_tree, b_tree, entries);
else
re->src_entry = item->util;
- item = string_list_lookup(re->pair->two->path, entries);
+ item = string_list_lookup(entries, re->pair->two->path);
if (!item)
re->dst_entry = insert_stage_data(re->pair->two->path,
o_tree, a_tree, b_tree, entries);
output(o, 1, "Adding as %s instead", new_path);
update_file(o, 0, dst_other.sha1, dst_other.mode, new_path);
}
- } else if ((item = string_list_lookup(ren1_dst, renames2Dst))) {
+ } else if ((item = string_list_lookup(renames2Dst, ren1_dst))) {
ren2 = item->util;
clean_merge = 0;
ren2->processed = 1;
diff --git a/reflog-walk.c b/reflog-walk.c
index f125f374612a373f0875951f3aa683cb19fea66a..4879615cad7527dc5346cd1a85bd56b9d11e052b 100644 (file)
--- a/reflog-walk.c
+++ b/reflog-walk.c
} else
recno = 0;
- item = string_list_lookup(branch, &info->complete_reflogs);
+ item = string_list_lookup(&info->complete_reflogs, branch);
if (item)
reflogs = item->util;
else {
diff --git a/remote.c b/remote.c
index 7ce714ca2fc9865278cc5adfe3c3866ca352f7a9..5a658381150520056ea70aed5a15882bbb448bd8 100644 (file)
--- a/remote.c
+++ b/remote.c
if (!ref_map->peer_ref)
continue;
- item = string_list_lookup(ref_map->peer_ref->name, &refs);
+ item = string_list_lookup(&refs, ref_map->peer_ref->name);
if (item) {
if (strcmp(((struct ref *)item->util)->name,
ref_map->name))
diff --git a/resolve-undo.c b/resolve-undo.c
index 8b935594aaa707a6eff146a998250196ae2a654b..174ebec9e573b1942e379942037f38500bd19b97 100644 (file)
--- a/resolve-undo.c
+++ b/resolve-undo.c
pos++;
return pos - 1; /* return the last entry processed */
}
- item = string_list_lookup(ce->name, istate->resolve_undo);
+ item = string_list_lookup(istate->resolve_undo, ce->name);
if (!item)
return pos;
ru = item->util;
diff --git a/string-list.c b/string-list.c
index 84444c2c19e623ac7bf825ea331918b6db9e9666..7b616ae825ae08138e89ef47fb6d39b1fa54f6cb 100644 (file)
--- a/string-list.c
+++ b/string-list.c
return index;
}
-struct string_list_item *string_list_lookup(const char *string, struct string_list *list)
+struct string_list_item *string_list_lookup(struct string_list *list, const char *string)
{
int exact_match, i = get_entry_index(list, string, &exact_match);
if (!exact_match)
diff --git a/string-list.h b/string-list.h
index a4e1919ada3c2ac95765bc0e952b1328a18e53d1..4a30e9d1045def8a2b563580aea75d392cb5e131 100644 (file)
--- a/string-list.h
+++ b/string-list.h
struct string_list_item *string_list_insert(struct string_list *list, const char *string);
struct string_list_item *string_list_insert_at_index(struct string_list *list,
int insert_at, const char *string);
-struct string_list_item *string_list_lookup(const char *string, struct string_list *list);
+struct string_list_item *string_list_lookup(struct string_list *list, const char *string);
/* Use these functions only on unsorted lists: */
struct string_list_item *string_list_append(const char *string, struct string_list *list);