{"thread":{"id":"1143","subject":"[PATCH 2/13] Swap order of insert_by_date arguments","startedAt":"2005-07-06T16:39:34Z","lastAt":"2005-07-06T16:39:34Z","messageCount":1,"participants":["Jon Seymour"],"isPatch":true,"patchVersion":1,"patchTotal":13},"messages":[{"id":"5725","messageId":"20050706163934.9831.qmail@blackcubes.dyndns.org","threadId":"1143","inReplyTo":null,"subject":"[PATCH 2/13] Swap order of insert_by_date arguments","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2005-07-06T16:39:34Z","receivedAt":"2005-07-06T16:39:34Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"\nSwap the order of insert_by_date arguments so that it\nmatches the order of commit_list_insert.\n\nThis patch anticipates a future change which will call the\nfunction via a pointer.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n\n commit.c   |    8 ++++----\n commit.h   |    6 +++++-\n epoch.c    |    4 ++--\n rev-list.c |    2 +-\n 4 files changed, 12 insertions(+), 8 deletions(-)\n\n486d4dee9772a59b955574951e8d4946b75cf9fa\ndiff --git a/commit.c b/commit.c\n--- a/commit.c\n+++ b/commit.c\n@@ -147,7 +147,7 @@ void free_commit_list(struct commit_list\n \t}\n }\n \n-void insert_by_date(struct commit_list **list, struct commit *item)\n+struct commit_list * insert_by_date(struct commit *item, struct commit_list **list)\n {\n \tstruct commit_list **pp = list;\n \tstruct commit_list *p;\n@@ -157,7 +157,7 @@ void insert_by_date(struct commit_list *\n \t\t}\n \t\tpp = &p->next;\n \t}\n-\tcommit_list_insert(item, pp);\n+\treturn commit_list_insert(item, pp);\n }\n \n \t\n@@ -165,7 +165,7 @@ void sort_by_date(struct commit_list **l\n {\n \tstruct commit_list *ret = NULL;\n \twhile (*list) {\n-\t\tinsert_by_date(&ret, (*list)->item);\n+\t\tinsert_by_date((*list)->item, &ret);\n \t\t*list = (*list)->next;\n \t}\n \t*list = ret;\n@@ -186,7 +186,7 @@ struct commit *pop_most_recent_commit(st\n \t\tparse_commit(commit);\n \t\tif (!(commit->object.flags & mark)) {\n \t\t\tcommit->object.flags |= mark;\n-\t\t\tinsert_by_date(list, commit);\n+\t\t\tinsert_by_date(commit, list);\n \t\t}\n \t\tparents = parents->next;\n \t}\ndiff --git a/commit.h b/commit.h\n--- a/commit.h\n+++ b/commit.h\n@@ -44,7 +44,11 @@ enum cmit_fmt {\n extern enum cmit_fmt get_commit_format(const char *arg);\n extern unsigned long pretty_print_commit(enum cmit_fmt fmt, const char *msg, unsigned long len, char *buf, unsigned long space);\n \n-void insert_by_date(struct commit_list **list, struct commit *item);\n+/*\n+ * Inserts item into the list specified in most recent commit date first order.\n+ * A pointer to the most recently inserted item is returned.\n+ */\n+struct commit_list * insert_by_date(struct commit *item, struct commit_list **list);\n \n /** Removes the first commit from a list sorted by date, and adds all\n  * of its parents.\ndiff --git a/epoch.c b/epoch.c\n--- a/epoch.c\n+++ b/epoch.c\n@@ -255,11 +255,11 @@ static int find_base_for_list(struct com\n \n \t\t\t\tif (!parent_node) {\n \t\t\t\t\tparent_node = new_mass_counter(parent, &distribution);\n-\t\t\t\t\tinsert_by_date(&pending, parent);\n+\t\t\t\t\tinsert_by_date(parent, &pending);\n \t\t\t\t\tcommit_list_insert(parent, &cleaner);\n \t\t\t\t} else {\n \t\t\t\t\tif (!compare(&parent_node->pending, get_zero()))\n-\t\t\t\t\t\tinsert_by_date(&pending, parent);\n+\t\t\t\t\t\tinsert_by_date(parent, &pending);\n \t\t\t\t\tadd(&parent_node->pending, &parent_node->pending, &distribution);\n \t\t\t\t}\n \t\t\t}\ndiff --git a/rev-list.c b/rev-list.c\n--- a/rev-list.c\n+++ b/rev-list.c\n@@ -483,7 +483,7 @@ int main(int argc, char **argv)\n \t\tif (!commit)\n \t\t\tcontinue;\n \t\tif (!merge_order) \n-\t\t\tinsert_by_date(&list, commit);\n+\t\t\tinsert_by_date(commit, &list);\n \t\telse \n \t\t\tcommit_list_insert(commit, &list);\n \t}\n------------\n"}]}