Skip to content

Commit 3cd4745

Browse files
tfarinagitster
authored andcommitted
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>
1 parent 515cc01 commit 3cd4745

7 files changed

Lines changed: 8 additions & 6 deletions

File tree

builtin/fast-export.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ static void import_marks(char *input_file)
565565
int cmd_fast_export(int argc, const char **argv, const char *prefix)
566566
{
567567
struct rev_info revs;
568-
struct object_array commits = { 0, 0, NULL };
568+
struct object_array commits = OBJECT_ARRAY_INIT;
569569
struct string_list extra_refs = STRING_LIST_INIT_NODUP;
570570
struct commit *commit;
571571
char *export_filename = NULL, *import_filename = NULL;

builtin/grep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
834834
int external_grep_allowed__ignored;
835835
const char *show_in_pager = NULL, *default_pager = "dummy";
836836
struct grep_opt opt;
837-
struct object_array list = { 0, 0, NULL };
837+
struct object_array list = OBJECT_ARRAY_INIT;
838838
const char **paths = NULL;
839839
struct string_list path_list = STRING_LIST_INIT_NODUP;
840840
int i;

builtin/name-rev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static void name_rev_line(char *p, struct name_ref_data *data)
220220

221221
int cmd_name_rev(int argc, const char **argv, const char *prefix)
222222
{
223-
struct object_array revs = { 0, 0, NULL };
223+
struct object_array revs = OBJECT_ARRAY_INIT;
224224
int all = 0, transform_stdin = 0, allow_undefined = 1, always = 0;
225225
struct name_ref_data data = { 0, 0, NULL };
226226
struct option opts[] = {

object.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ struct object_array {
2121
} *objects;
2222
};
2323

24+
#define OBJECT_ARRAY_INIT { 0, 0, NULL }
25+
2426
#define TYPE_BITS 3
2527
#define FLAG_BITS 27
2628

reachable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static void walk_commit_list(struct rev_info *revs)
9090
{
9191
int i;
9292
struct commit *commit;
93-
struct object_array objects = { 0, 0, NULL };
93+
struct object_array objects = OBJECT_ARRAY_INIT;
9494

9595
/* Walk all commits, process their trees */
9696
while ((commit = get_revision(revs)) != NULL)

shallow.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
4747
{
4848
int i = 0, cur_depth = 0;
4949
struct commit_list *result = NULL;
50-
struct object_array stack = {0, 0, NULL};
50+
struct object_array stack = OBJECT_ARRAY_INIT;
5151
struct commit *commit = NULL;
5252

5353
while (commit || i < heads->nr || stack.nr) {

upload-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ static int get_common_commits(void)
482482

483483
static void receive_needs(void)
484484
{
485-
struct object_array shallows = {0, 0, NULL};
485+
struct object_array shallows = OBJECT_ARRAY_INIT;
486486
static char line[1000];
487487
int len, depth = 0;
488488

0 commit comments

Comments
 (0)