aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Farina <tfransosi@gmail.com>2010-08-28 23:04:17 -0300
committerJunio C Hamano <gitster@pobox.com>2010-08-29 22:42:49 -0700
commit3cd474599f1ede41863c523ddf76c94941b08164 (patch)
tree3ea9f6249e8c08a865f5d3b309d3c77e007c04d9
parent515cc0101943b766fde7aa894827119e332ec033 (diff)
downloadgit-3cd474599f1ede41863c523ddf76c94941b08164.tar.gz
git-3cd474599f1ede41863c523ddf76c94941b08164.tar.xz
object.h: Add OBJECT_ARRAY_INIT macro and make use of it.
Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/fast-export.c2
-rw-r--r--builtin/grep.c2
-rw-r--r--builtin/name-rev.c2
-rw-r--r--object.h2
-rw-r--r--reachable.c2
-rw-r--r--shallow.c2
-rw-r--r--upload-pack.c2
7 files changed, 8 insertions, 6 deletions
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 834ec8b46..ab792d5db 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 cf6c29fa4..b725ede0f 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 06a38ac8c..31f5c1c97 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 82877c831..4d1d61546 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 b515fa2de..a03fabf06 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 4d90eda19..a0363dea2 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 fc79ddef2..92f9530c6 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;