[PATCH 4/6] string_list: Fix argument order for string_list_insert_at_index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Update the definition and callers of string_list_insert_at_index 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@xxxxxxxxxxxxxxxxx>
---
 mailmap.c     |    2 +-
 string-list.c |    6 +++---
 string-list.h |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mailmap.c b/mailmap.c
index badf6a4..8b6dc36 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -69,7 +69,7 @@ static void add_mapping(struct string_list *map,
 		index = -1 - index;
 	} else {
 		/* create mailmap entry */
-		struct string_list_item *item = string_list_insert_at_index(index, old_email, map);
+		struct string_list_item *item = string_list_insert_at_index(map, index, old_email);
 		item->util = xmalloc(sizeof(struct mailmap_entry));
 		memset(item->util, 0, sizeof(struct mailmap_entry));
 		((struct mailmap_entry *)item->util)->namemap.strdup_strings = 1;
diff --git a/string-list.c b/string-list.c
index de89efd..84444c2 100644
--- a/string-list.c
+++ b/string-list.c
@@ -53,11 +53,11 @@ static int add_entry(int insert_at, struct string_list *list, const char *string
 
 struct string_list_item *string_list_insert(struct string_list *list, const char *string)
 {
-	return string_list_insert_at_index(-1, string, list);
+	return string_list_insert_at_index(list, -1, string);
 }
 
-struct string_list_item *string_list_insert_at_index(int insert_at,
-						     const char *string, struct string_list *list)
+struct string_list_item *string_list_insert_at_index(struct string_list *list,
+						     int insert_at, const char *string)
 {
 	int index = add_entry(insert_at, list, string);
 
diff --git a/string-list.h b/string-list.h
index 3d5a8de..a4e1919 100644
--- a/string-list.h
+++ b/string-list.h
@@ -30,8 +30,8 @@ int string_list_has_string(const struct string_list *list, const char *string);
 int string_list_find_insert_index(const struct string_list *list, const char *string,
 				  int negative_existing_index);
 struct string_list_item *string_list_insert(struct string_list *list, const char *string);
-struct string_list_item *string_list_insert_at_index(int insert_at,
-						     const char *string, struct string_list *list);
+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);
 
 /* Use these functions only on unsorted lists: */
-- 
1.7.0.2


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]