@matheusbsbs / matheus-bagliano / commits / 3cd474599f
Fork 0

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>

Thiago Farina committed Aug 28, 2010 at 23:04 UTC 3cd474599f1ede41863c523ddf76c94941b08164
7 files changed +8 -6
builtin/fast-export.c
+1 -1
@@ -565,7 +565,7 @@ static void import_marks(char *input_file)
565 int cmd_fast_export(int argc, const char **argv, const char *prefix)
566 {
567 struct rev_info revs;
568 - struct object_array commits = { 0, 0, NULL };
568 + struct object_array commits = OBJECT_ARRAY_INIT;
569 struct string_list extra_refs = STRING_LIST_INIT_NODUP;
570 struct commit *commit;
571 char *export_filename = NULL, *import_filename = NULL;
builtin/grep.c
+1 -1
@@ -834,7 +834,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
834 int external_grep_allowed__ignored;
835 const char *show_in_pager = NULL, *default_pager = "dummy";
836 struct grep_opt opt;
837 - struct object_array list = { 0, 0, NULL };
837 + struct object_array list = OBJECT_ARRAY_INIT;
838 const char **paths = NULL;
839 struct string_list path_list = STRING_LIST_INIT_NODUP;
840 int i;
builtin/name-rev.c
+1 -1
@@ -220,7 +220,7 @@ static void name_rev_line(char *p, struct name_ref_data *data)
220
221 int cmd_name_rev(int argc, const char **argv, const char *prefix)
222 {
223 - struct object_array revs = { 0, 0, NULL };
223 + struct object_array revs = OBJECT_ARRAY_INIT;
224 int all = 0, transform_stdin = 0, allow_undefined = 1, always = 0;
225 struct name_ref_data data = { 0, 0, NULL };
226 struct option opts[] = {
object.h
+2
@@ -21,6 +21,8 @@ struct object_array {
21 } *objects;
22 };
23
24 +#define OBJECT_ARRAY_INIT { 0, 0, NULL }
25 +
26 #define TYPE_BITS 3
27 #define FLAG_BITS 27
28
reachable.c
+1 -1
@@ -90,7 +90,7 @@ static void walk_commit_list(struct rev_info *revs)
90 {
91 int i;
92 struct commit *commit;
93 - struct object_array objects = { 0, 0, NULL };
93 + struct object_array objects = OBJECT_ARRAY_INIT;
94
95 /* Walk all commits, process their trees */
96 while ((commit = get_revision(revs)) != NULL)
shallow.c
+1 -1
@@ -47,7 +47,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
47 {
48 int i = 0, cur_depth = 0;
49 struct commit_list *result = NULL;
50 - struct object_array stack = {0, 0, NULL};
50 + struct object_array stack = OBJECT_ARRAY_INIT;
51 struct commit *commit = NULL;
52
53 while (commit || i < heads->nr || stack.nr) {
upload-pack.c
+1 -1
@@ -482,7 +482,7 @@ static int get_common_commits(void)
482
483 static void receive_needs(void)
484 {
485 - struct object_array shallows = {0, 0, NULL};
485 + struct object_array shallows = OBJECT_ARRAY_INIT;
486 static char line[1000];
487 int len, depth = 0;
488