All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] object.h: Add OBJECT_ARRAY_INIT macro and make use of it.
@ 2010-08-29  2:04 Thiago Farina
  2010-08-29  2:15 ` Sverre Rabbelier
  0 siblings, 1 reply; 3+ messages in thread
From: Thiago Farina @ 2010-08-29  2:04 UTC (permalink / raw)
  To: git; +Cc: gitster, jrnieder, srabbelier, Thiago Farina

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
---
As suggested in: <AANLkTimWQwBdcVgZK5GGmIXOcpgLpgp28ywFi6MJVnyJ@mail.gmail.com>,
by Sverre Rabbelier.

 builtin/fast-export.c |    2 +-
 builtin/grep.c        |    2 +-
 builtin/name-rev.c    |    2 +-
 object.h              |    2 ++
 reachable.c           |    2 +-
 shallow.c             |    2 +-
 upload-pack.c         |    2 +-
 7 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 834ec8b..ab792d5 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -565,7 +565,7 @@ static void import_marks(char *input_file)
 int cmd_fast_export(int argc, const char **argv, const char *prefix)
 {
 	struct rev_info revs;
-	struct object_array commits = { 0, 0, NULL };
+	struct object_array commits = OBJECT_ARRAY_INIT;
 	struct string_list extra_refs = STRING_LIST_INIT_NODUP;
 	struct commit *commit;
 	char *export_filename = NULL, *import_filename = NULL;
diff --git a/builtin/grep.c b/builtin/grep.c
index cf6c29f..b725ede 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -834,7 +834,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 	int external_grep_allowed__ignored;
 	const char *show_in_pager = NULL, *default_pager = "dummy";
 	struct grep_opt opt;
-	struct object_array list = { 0, 0, NULL };
+	struct object_array list = OBJECT_ARRAY_INIT;
 	const char **paths = NULL;
 	struct string_list path_list = STRING_LIST_INIT_NODUP;
 	int i;
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index 06a38ac..31f5c1c 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -220,7 +220,7 @@ static void name_rev_line(char *p, struct name_ref_data *data)
 
 int cmd_name_rev(int argc, const char **argv, const char *prefix)
 {
-	struct object_array revs = { 0, 0, NULL };
+	struct object_array revs = OBJECT_ARRAY_INIT;
 	int all = 0, transform_stdin = 0, allow_undefined = 1, always = 0;
 	struct name_ref_data data = { 0, 0, NULL };
 	struct option opts[] = {
diff --git a/object.h b/object.h
index 82877c8..4d1d615 100644
--- a/object.h
+++ b/object.h
@@ -21,6 +21,8 @@ struct object_array {
 	} *objects;
 };
 
+#define OBJECT_ARRAY_INIT { 0, 0, NULL }
+
 #define TYPE_BITS   3
 #define FLAG_BITS  27
 
diff --git a/reachable.c b/reachable.c
index b515fa2..a03fabf 100644
--- a/reachable.c
+++ b/reachable.c
@@ -90,7 +90,7 @@ static void walk_commit_list(struct rev_info *revs)
 {
 	int i;
 	struct commit *commit;
-	struct object_array objects = { 0, 0, NULL };
+	struct object_array objects = OBJECT_ARRAY_INIT;
 
 	/* Walk all commits, process their trees */
 	while ((commit = get_revision(revs)) != NULL)
diff --git a/shallow.c b/shallow.c
index 4d90eda..a0363de 100644
--- a/shallow.c
+++ b/shallow.c
@@ -47,7 +47,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
 {
 	int i = 0, cur_depth = 0;
 	struct commit_list *result = NULL;
-	struct object_array stack = {0, 0, NULL};
+	struct object_array stack = OBJECT_ARRAY_INIT;
 	struct commit *commit = NULL;
 
 	while (commit || i < heads->nr || stack.nr) {
diff --git a/upload-pack.c b/upload-pack.c
index fc79dde..92f9530 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -482,7 +482,7 @@ static int get_common_commits(void)
 
 static void receive_needs(void)
 {
-	struct object_array shallows = {0, 0, NULL};
+	struct object_array shallows = OBJECT_ARRAY_INIT;
 	static char line[1000];
 	int len, depth = 0;
 
-- 
1.7.2.1.95.g3d045

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] object.h: Add OBJECT_ARRAY_INIT macro and make use of it.
  2010-08-29  2:04 [PATCH] object.h: Add OBJECT_ARRAY_INIT macro and make use of it Thiago Farina
@ 2010-08-29  2:15 ` Sverre Rabbelier
  2010-08-30  5:42   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Sverre Rabbelier @ 2010-08-29  2:15 UTC (permalink / raw)
  To: Thiago Farina; +Cc: git, gitster, jrnieder

Heya,

On Sat, Aug 28, 2010 at 21:04, Thiago Farina <tfransosi@gmail.com> wrote:
> As suggested in: <AANLkTimWQwBdcVgZK5GGmIXOcpgLpgp28ywFi6MJVnyJ@mail.gmail.com>,
> by Sverre Rabbelier.

For those who wondered like I did, the related "string_list: Add
STRING_LIST_INIT macro and make use of it." (which was discussed in
[0]) was committed as v1.7.2-rc1-3-g183113a on Sun Jul 4.

[0] http://thread.gmane.org/gmane.comp.version-control.git/149779/focus=150160

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] object.h: Add OBJECT_ARRAY_INIT macro and make use of it.
  2010-08-29  2:15 ` Sverre Rabbelier
@ 2010-08-30  5:42   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2010-08-30  5:42 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Thiago Farina, git, jrnieder

Sverre Rabbelier <srabbelier@gmail.com> writes:

> On Sat, Aug 28, 2010 at 21:04, Thiago Farina <tfransosi@gmail.com> wrote:
>> As suggested in: <AANLkTimWQwBdcVgZK5GGmIXOcpgLpgp28ywFi6MJVnyJ@mail.gmail.com>,
>> by Sverre Rabbelier.
>
> For those who wondered like I did, the related "string_list: Add
> STRING_LIST_INIT macro and make use of it." (which was discussed in
> [0]) was committed as v1.7.2-rc1-3-g183113a on Sun Jul 4.

Unlike 183113a that cleaned up 30 or so invocations, this is about only 6
initializations.  I personally wouldn't have bothered, but the patch
already exists and looks correct, so why not.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-30  5:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-29  2:04 [PATCH] object.h: Add OBJECT_ARRAY_INIT macro and make use of it Thiago Farina
2010-08-29  2:15 ` Sverre Rabbelier
2010-08-30  5:42   ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.