{"thread":{"id":"18628","subject":"[PATCH v2 1/2] rev-list: pass a flag as last argument of \"show_bisect_vars\"","startedAt":"2009-03-30T04:59:57Z","lastAt":"2009-03-30T04:59:57Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"109817","messageId":"20090330065957.5ba1675c.chriscool@tuxfamily.org","threadId":"18628","inReplyTo":null,"subject":"[PATCH v2 1/2] rev-list: pass a flag as last argument of \"show_bisect_vars\"","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-03-30T04:59:57Z","receivedAt":"2009-03-30T04:59:57Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Instead of \"int show_all, int show_tried\" we now only pass \"int flags\",\nbecause we will add more flags in a later patch.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n bisect.c           |    2 +-\n bisect.h           |    8 ++++++--\n builtin-rev-list.c |   13 ++++++-------\n 3 files changed, 13 insertions(+), 10 deletions(-)\n\ndiff --git a/bisect.c b/bisect.c\nindex 66df05f..64a5ad5 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -554,5 +554,5 @@ int bisect_next_vars(const char *prefix)\n \trevs.commits = find_bisection(revs.commits, &reaches, &all,\n \t\t\t\t      !!skipped_sha1_nr);\n \n-\treturn show_bisect_vars(&revs, reaches, all, 0, 1);\n+\treturn show_bisect_vars(&revs, reaches, all, SHOW_TRIED);\n }\ndiff --git a/bisect.h b/bisect.h\nindex 05eea17..4cff2ba 100644\n--- a/bisect.h\n+++ b/bisect.h\n@@ -9,13 +9,17 @@ extern struct commit_list *filter_skipped(struct commit_list *list,\n \t\t\t\t\t  struct commit_list **tried,\n \t\t\t\t\t  int show_all);\n \n+/* show_bisect_vars flags */\n+#define SHOW_ALL\t1\n+#define SHOW_TRIED\t2\n+\n /*\n- * The \"show_all\" parameter should be 0 if this function is called\n+ * The flag SHOW_ALL should not be set if this function is called\n  * from outside \"builtin-rev-list.c\" as otherwise it would use\n  * static \"revs\" from this file.\n  */\n extern int show_bisect_vars(struct rev_info *revs, int reaches, int all,\n-\t\t\t    int show_all, int show_tried);\n+\t\t\t    int flags);\n \n extern int bisect_next_vars(const char *prefix);\n \ndiff --git a/builtin-rev-list.c b/builtin-rev-list.c\nindex 925d643..c1c4a18 100644\n--- a/builtin-rev-list.c\n+++ b/builtin-rev-list.c\n@@ -236,17 +236,16 @@ static void show_tried_revs(struct commit_list *tried)\n \tprintf(\"'\\n\");\n }\n \n-int show_bisect_vars(struct rev_info *revs, int reaches, int all,\n-\t\t     int show_all, int show_tried)\n+int show_bisect_vars(struct rev_info *revs, int reaches, int all, int flags)\n {\n \tint cnt;\n \tchar hex[41] = \"\";\n \tstruct commit_list *tried;\n \n-\tif (!revs->commits && !show_tried)\n+\tif (!revs->commits && !(flags & SHOW_TRIED))\n \t\treturn 1;\n \n-\trevs->commits = filter_skipped(revs->commits, &tried, show_all);\n+\trevs->commits = filter_skipped(revs->commits, &tried, flags & SHOW_ALL);\n \n \t/*\n \t * revs->commits can reach \"reaches\" commits among\n@@ -264,12 +263,12 @@ int show_bisect_vars(struct rev_info *revs, int reaches, int all,\n \tif (revs->commits)\n \t\tstrcpy(hex, sha1_to_hex(revs->commits->item->object.sha1));\n \n-\tif (show_all) {\n+\tif (flags & SHOW_ALL) {\n \t\ttraverse_commit_list(revs, show_commit, show_object);\n \t\tprintf(\"------\\n\");\n \t}\n \n-\tif (show_tried)\n+\tif (flags & SHOW_TRIED)\n \t\tshow_tried_revs(tried);\n \tprintf(\"bisect_rev=%s\\n\"\n \t       \"bisect_nr=%d\\n\"\n@@ -379,7 +378,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \n \t\tif (bisect_show_vars)\n \t\t\treturn show_bisect_vars(&revs, reaches, all,\n-\t\t\t\t\t\tbisect_show_all, 0);\n+\t\t\t\t\t\tbisect_show_all ? SHOW_ALL : 0);\n \t}\n \n \ttraverse_commit_list(&revs,\n-- \n1.6.2.1.404.gb0085.dirty\n"}]}