]> asedeno.scripts.mit.edu Git - git.git/commitdiff
object.h: Add OBJECT_ARRAY_INIT macro and make use of it.
authorThiago Farina <tfransosi@gmail.com>
Sun, 29 Aug 2010 02:04:17 +0000 (23:04 -0300)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Aug 2010 05:42:49 +0000 (22:42 -0700)
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fast-export.c
builtin/grep.c
builtin/name-rev.c
object.h
reachable.c
shallow.c
upload-pack.c

index 834ec8b464d0ce5845a2312766554b60ed5d5d7e..ab792d5db2ba6e96acd6f8401879442667b66cfb 100644 (file)
@@ -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;
index cf6c29fa42d96f8bc8282e779617a60d40796166..b725ede0f7270637759b9fef52ab5450fc1712e2 100644 (file)
@@ -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;
index 06a38ac8c10126085e6477c205d450da089faae2..31f5c1c971381a9490b717e0413ee9a40260ef39 100644 (file)
@@ -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[] = {
index 82877c831ca7fe39abbb98805f5801bdc6fcac9c..4d1d61546f0441bd198cda3ad153b35a91444b72 100644 (file)
--- 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
 
index b515fa2de332cc570a8a32861bd8d6491b61133e..a03fabf060081e9fa5e0d753cd0d9cf4bca5062e 100644 (file)
@@ -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)
index 4d90eda19efe0a80c1cb39e8897ab3ed5e6fcf56..a0363dea203d2a06e985bb4e140ffc675428cbf8 100644 (file)
--- 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) {
index fc79ddef255a49176acab52c6492c1086b4e6e44..92f9530c6572a212c12ac917d774736286325e52 100644 (file)
@@ -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;