{"thread":{"id":"24897","subject":"[PATCH] object.h: Add OBJECT_ARRAY_INIT macro and make use of it.","startedAt":"2010-08-29T02:04:17Z","lastAt":"2010-08-30T05:42:20Z","messageCount":3,"participants":["Thiago Farina","Sverre Rabbelier","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"149186","messageId":"b5ec0461c869bb49b190c2f4f3203fa59107ac25.1283046991.git.tfransosi@gmail.com","threadId":"24897","inReplyTo":null,"subject":"[PATCH] object.h: Add OBJECT_ARRAY_INIT macro and make use of it.","fromName":"Thiago Farina","fromEmail":"tfransosi@gmail.com","sentAt":"2010-08-29T02:04:17Z","receivedAt":"2010-08-29T02:04:17Z","isPatch":true,"sender":{"key":"tfransosi@gmail.com","avatar":"https://avatars.githubusercontent.com/u/970071?v=4"},"body":"Signed-off-by: Thiago Farina <tfransosi@gmail.com>\n---\nAs suggested in: <AANLkTimWQwBdcVgZK5GGmIXOcpgLpgp28ywFi6MJVnyJ@mail.gmail.com>,\nby Sverre Rabbelier.\n\n builtin/fast-export.c |    2 +-\n builtin/grep.c        |    2 +-\n builtin/name-rev.c    |    2 +-\n object.h              |    2 ++\n reachable.c           |    2 +-\n shallow.c             |    2 +-\n upload-pack.c         |    2 +-\n 7 files changed, 8 insertions(+), 6 deletions(-)\n\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 834ec8b..ab792d5 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -565,7 +565,7 @@ static void import_marks(char *input_file)\n int cmd_fast_export(int argc, const char **argv, const char *prefix)\n {\n \tstruct rev_info revs;\n-\tstruct object_array commits = { 0, 0, NULL };\n+\tstruct object_array commits = OBJECT_ARRAY_INIT;\n \tstruct string_list extra_refs = STRING_LIST_INIT_NODUP;\n \tstruct commit *commit;\n \tchar *export_filename = NULL, *import_filename = NULL;\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex cf6c29f..b725ede 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -834,7 +834,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n \tint external_grep_allowed__ignored;\n \tconst char *show_in_pager = NULL, *default_pager = \"dummy\";\n \tstruct grep_opt opt;\n-\tstruct object_array list = { 0, 0, NULL };\n+\tstruct object_array list = OBJECT_ARRAY_INIT;\n \tconst char **paths = NULL;\n \tstruct string_list path_list = STRING_LIST_INIT_NODUP;\n \tint i;\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 06a38ac..31f5c1c 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -220,7 +220,7 @@ static void name_rev_line(char *p, struct name_ref_data *data)\n \n int cmd_name_rev(int argc, const char **argv, const char *prefix)\n {\n-\tstruct object_array revs = { 0, 0, NULL };\n+\tstruct object_array revs = OBJECT_ARRAY_INIT;\n \tint all = 0, transform_stdin = 0, allow_undefined = 1, always = 0;\n \tstruct name_ref_data data = { 0, 0, NULL };\n \tstruct option opts[] = {\ndiff --git a/object.h b/object.h\nindex 82877c8..4d1d615 100644\n--- a/object.h\n+++ b/object.h\n@@ -21,6 +21,8 @@ struct object_array {\n \t} *objects;\n };\n \n+#define OBJECT_ARRAY_INIT { 0, 0, NULL }\n+\n #define TYPE_BITS   3\n #define FLAG_BITS  27\n \ndiff --git a/reachable.c b/reachable.c\nindex b515fa2..a03fabf 100644\n--- a/reachable.c\n+++ b/reachable.c\n@@ -90,7 +90,7 @@ static void walk_commit_list(struct rev_info *revs)\n {\n \tint i;\n \tstruct commit *commit;\n-\tstruct object_array objects = { 0, 0, NULL };\n+\tstruct object_array objects = OBJECT_ARRAY_INIT;\n \n \t/* Walk all commits, process their trees */\n \twhile ((commit = get_revision(revs)) != NULL)\ndiff --git a/shallow.c b/shallow.c\nindex 4d90eda..a0363de 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -47,7 +47,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,\n {\n \tint i = 0, cur_depth = 0;\n \tstruct commit_list *result = NULL;\n-\tstruct object_array stack = {0, 0, NULL};\n+\tstruct object_array stack = OBJECT_ARRAY_INIT;\n \tstruct commit *commit = NULL;\n \n \twhile (commit || i < heads->nr || stack.nr) {\ndiff --git a/upload-pack.c b/upload-pack.c\nindex fc79dde..92f9530 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -482,7 +482,7 @@ static int get_common_commits(void)\n \n static void receive_needs(void)\n {\n-\tstruct object_array shallows = {0, 0, NULL};\n+\tstruct object_array shallows = OBJECT_ARRAY_INIT;\n \tstatic char line[1000];\n \tint len, depth = 0;\n \n-- \n1.7.2.1.95.g3d045\n"},{"id":"149187","messageId":"AANLkTikTeZqqBhzOuA+f7OpQq4nEQmOAOUATO+kN-HjK@mail.gmail.com","threadId":"24897","inReplyTo":"b5ec0461c869bb49b190c2f4f3203fa59107ac25.1283046991.git.tfransosi@gmail.com","subject":"Re: [PATCH] object.h: Add OBJECT_ARRAY_INIT macro and make use of it.","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-08-29T02:15:12Z","receivedAt":"2010-08-29T02:15:12Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sat, Aug 28, 2010 at 21:04, Thiago Farina <tfransosi@gmail.com> wrote:\n> As suggested in: <AANLkTimWQwBdcVgZK5GGmIXOcpgLpgp28ywFi6MJVnyJ@mail.gmail.com>,\n> by Sverre Rabbelier.\n\nFor those who wondered like I did, the related \"string_list: Add\nSTRING_LIST_INIT macro and make use of it.\" (which was discussed in\n[0]) was committed as v1.7.2-rc1-3-g183113a on Sun Jul 4.\n\n[0] http://thread.gmane.org/gmane.comp.version-control.git/149779/focus=150160\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"149280","messageId":"7vtymchd1f.fsf@alter.siamese.dyndns.org","threadId":"24897","inReplyTo":"AANLkTikTeZqqBhzOuA+f7OpQq4nEQmOAOUATO+kN-HjK@mail.gmail.com","subject":"Re: [PATCH] object.h: Add OBJECT_ARRAY_INIT macro and make use of it.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-30T05:42:20Z","receivedAt":"2010-08-30T05:42:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sverre Rabbelier <srabbelier@gmail.com> writes:\n\n> On Sat, Aug 28, 2010 at 21:04, Thiago Farina <tfransosi@gmail.com> wrote:\n>> As suggested in: <AANLkTimWQwBdcVgZK5GGmIXOcpgLpgp28ywFi6MJVnyJ@mail.gmail.com>,\n>> by Sverre Rabbelier.\n>\n> For those who wondered like I did, the related \"string_list: Add\n> STRING_LIST_INIT macro and make use of it.\" (which was discussed in\n> [0]) was committed as v1.7.2-rc1-3-g183113a on Sun Jul 4.\n\nUnlike 183113a that cleaned up 30 or so invocations, this is about only 6\ninitializations.  I personally wouldn't have bothered, but the patch\nalready exists and looks correct, so why not.\n\nThanks.\n"}]}