Skip to content

Commit

Permalink
object.h: Add OBJECT_ARRAY_INIT macro and make use of it.
Browse files Browse the repository at this point in the history
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
tfarina authored and gitster committed Aug 30, 2010
1 parent 515cc01 commit 3cd4745
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion builtin/fast-export.c
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion builtin/grep.c
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion builtin/name-rev.c
Expand Up @@ -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[] = {
Expand Down
2 changes: 2 additions & 0 deletions object.h
Expand Up @@ -21,6 +21,8 @@ struct object_array {
} *objects;
};

#define OBJECT_ARRAY_INIT { 0, 0, NULL }

#define TYPE_BITS 3
#define FLAG_BITS 27

Expand Down
2 changes: 1 addition & 1 deletion reachable.c
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion shallow.c
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion upload-pack.c
Expand Up @@ -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;

Expand Down

0 comments on commit 3cd4745

Please sign in to comment.