summaryrefslogtreecommitdiff
path: root/string-list.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-04-06 14:50:46 -0700
committerJunio C Hamano <gitster@pobox.com>2010-04-06 14:50:46 -0700
commitae722b4e2796522261b0f130eb86b665499625e6 (patch)
tree95dc131c0b1e306b7f1206f1ea3e179547290171 /string-list.c
parent3f3f8d9d09cdb6810e848d82583749e6080d2167 (diff)
parent63e671508782ca2dd386e5878d3682090fd64eda (diff)
Merge branch 'sb/fmt-merge-msg'
* sb/fmt-merge-msg: fmt-merge-msg: hide summary option fmt-merge-msg: remove custom string_list implementation string-list: add unsorted_string_list_lookup() fmt-merge-msg: use pretty.c routines t6200: test fmt-merge-msg more t6200: modernize with test_tick fmt-merge-msg: be quiet if nothing to merge
Diffstat (limited to 'string-list.c')
-rw-r--r--string-list.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/string-list.c b/string-list.c
index 1ac536e638..c9ad7fcd49 100644
--- a/string-list.c
+++ b/string-list.c
@@ -168,12 +168,19 @@ void sort_string_list(struct string_list *list)
qsort(list->items, list->nr, sizeof(*list->items), cmp_items);
}
-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,
+ const char *string)
{
int i;
for (i = 0; i < list->nr; i++)
if (!strcmp(string, list->items[i].string))
- return 1;
- return 0;
+ return list->items + i;
+ return NULL;
+}
+
+int unsorted_string_list_has_string(struct string_list *list,
+ const char *string)
+{
+ return unsorted_string_list_lookup(list, string) != NULL;
}