Skip to content

Commit 96f1e58

Browse files
rientjesJunio C Hamano
authored andcommitted
remove unnecessary initializations
[jc: I needed to hand merge the changes to the updated codebase, so the result needs to be checked.] Signed-off-by: David Rientjes <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c9c3470 commit 96f1e58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+163
-163
lines changed

blame.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ struct patch {
5656
static void get_blob(struct commit *commit);
5757

5858
/* Only used for statistics */
59-
static int num_get_patch = 0;
60-
static int num_commits = 0;
61-
static int patch_time = 0;
59+
static int num_get_patch;
60+
static int num_commits;
61+
static int patch_time;
6262

6363
struct blame_diff_state {
6464
struct xdiff_emit_state xm;

builtin-apply.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ static int prefix_length = -1;
2828
static int newfd = -1;
2929

3030
static int p_value = 1;
31-
static int allow_binary_replacement = 0;
32-
static int check_index = 0;
33-
static int write_index = 0;
34-
static int cached = 0;
35-
static int diffstat = 0;
36-
static int numstat = 0;
37-
static int summary = 0;
38-
static int check = 0;
31+
static int allow_binary_replacement;
32+
static int check_index;
33+
static int write_index;
34+
static int cached;
35+
static int diffstat;
36+
static int numstat;
37+
static int summary;
38+
static int check;
3939
static int apply = 1;
40-
static int apply_in_reverse = 0;
41-
static int no_add = 0;
42-
static int show_index_info = 0;
40+
static int apply_in_reverse;
41+
static int no_add;
42+
static int show_index_info;
4343
static int line_termination = '\n';
4444
static unsigned long p_context = -1;
4545
static const char apply_usage[] =
@@ -51,10 +51,10 @@ static enum whitespace_eol {
5151
error_on_whitespace,
5252
strip_whitespace,
5353
} new_whitespace = warn_on_whitespace;
54-
static int whitespace_error = 0;
54+
static int whitespace_error;
5555
static int squelch_whitespace_errors = 5;
56-
static int applied_after_stripping = 0;
57-
static const char *patch_input_file = NULL;
56+
static int applied_after_stripping;
57+
static const char *patch_input_file;
5858

5959
static void parse_whitespace_option(const char *option)
6060
{

builtin-fmt-merge-msg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
static const char *fmt_merge_msg_usage =
99
"git-fmt-merge-msg [--summary] [--no-summary] [--file <file>]";
1010

11-
static int merge_summary = 0;
11+
static int merge_summary;
1212

1313
static int fmt_merge_msg_config(const char *key, const char *value)
1414
{

builtin-ls-files.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,22 @@
1212
#include "dir.h"
1313
#include "builtin.h"
1414

15-
static int abbrev = 0;
16-
static int show_deleted = 0;
17-
static int show_cached = 0;
18-
static int show_others = 0;
19-
static int show_stage = 0;
20-
static int show_unmerged = 0;
21-
static int show_modified = 0;
22-
static int show_killed = 0;
23-
static int show_valid_bit = 0;
15+
static int abbrev;
16+
static int show_deleted;
17+
static int show_cached;
18+
static int show_others;
19+
static int show_stage;
20+
static int show_unmerged;
21+
static int show_modified;
22+
static int show_killed;
23+
static int show_valid_bit;
2424
static int line_terminator = '\n';
2525

26-
static int prefix_len = 0, prefix_offset = 0;
27-
static const char **pathspec = NULL;
28-
static int error_unmatch = 0;
29-
static char *ps_matched = NULL;
26+
static int prefix_len;
27+
static int prefix_offset;
28+
static const char **pathspec;
29+
static int error_unmatch;
30+
static char *ps_matched;
3031

3132
static const char *tag_cached = "";
3233
static const char *tag_unmerged = "";

builtin-ls-tree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ static int line_termination = '\n';
1414
#define LS_TREE_ONLY 2
1515
#define LS_SHOW_TREES 4
1616
#define LS_NAME_ONLY 8
17-
static int abbrev = 0;
18-
static int ls_options = 0;
17+
static int abbrev;
18+
static int ls_options;
1919
static const char **pathspec;
20-
static int chomp_prefix = 0;
20+
static int chomp_prefix;
2121
static const char *ls_tree_prefix;
2222

2323
static const char ls_tree_usage[] =

builtin-mailinfo.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
static FILE *cmitmsg, *patchfile, *fin, *fout;
1818

19-
static int keep_subject = 0;
20-
static const char *metainfo_charset = NULL;
19+
static int keep_subject;
20+
static const char *metainfo_charset;
2121
static char line[1000];
2222
static char date[1000];
2323
static char name[1000];
@@ -31,7 +31,7 @@ static char charset[256];
3131

3232
static char multipart_boundary[1000];
3333
static int multipart_boundary_len;
34-
static int patch_lines = 0;
34+
static int patch_lines;
3535

3636
static char *sanity_check(char *name, char *email)
3737
{

builtin-name-rev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static void name_rev(struct commit *commit,
7575
}
7676
}
7777

78-
static int tags_only = 0;
78+
static int tags_only;
7979

8080
static int name_ref(const char *path, const unsigned char *sha1)
8181
{

builtin-pack-objects.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@ struct object_entry {
5353
*/
5454

5555
static unsigned char object_list_sha1[20];
56-
static int non_empty = 0;
57-
static int no_reuse_delta = 0;
58-
static int local = 0;
59-
static int incremental = 0;
56+
static int non_empty;
57+
static int no_reuse_delta;
58+
static int local;
59+
static int incremental;
6060
static struct object_entry **sorted_by_sha, **sorted_by_type;
61-
static struct object_entry *objects = NULL;
62-
static int nr_objects = 0, nr_alloc = 0, nr_result = 0;
61+
static struct object_entry *objects;
62+
static int nr_objects, nr_alloc, nr_result;
6363
static const char *base_name;
6464
static unsigned char pack_file_sha1[20];
6565
static int progress = 1;
66-
static volatile sig_atomic_t progress_update = 0;
66+
static volatile sig_atomic_t progress_update;
6767
static int window = 10;
6868

6969
/*
@@ -72,8 +72,8 @@ static int window = 10;
7272
* sorted_by_sha is also possible but this was easier to code and faster.
7373
* This hashtable is built after all the objects are seen.
7474
*/
75-
static int *object_ix = NULL;
76-
static int object_ix_hashsz = 0;
75+
static int *object_ix;
76+
static int object_ix_hashsz;
7777

7878
/*
7979
* Pack index for existing packs give us easy access to the offsets into
@@ -90,15 +90,15 @@ struct pack_revindex {
9090
struct packed_git *p;
9191
unsigned long *revindex;
9292
} *pack_revindex = NULL;
93-
static int pack_revindex_hashsz = 0;
93+
static int pack_revindex_hashsz;
9494

9595
/*
9696
* stats
9797
*/
98-
static int written = 0;
99-
static int written_delta = 0;
100-
static int reused = 0;
101-
static int reused_delta = 0;
98+
static int written;
99+
static int written_delta;
100+
static int reused;
101+
static int reused_delta;
102102

103103
static int pack_revindex_ix(struct packed_git *p)
104104
{

builtin-prune.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "cache-tree.h"
1212

1313
static const char prune_usage[] = "git-prune [-n]";
14-
static int show_only = 0;
14+
static int show_only;
1515
static struct rev_info revs;
1616

1717
static int prune_object(char *path, const char *filename, const unsigned char *sha1)

builtin-push.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
static const char push_usage[] = "git-push [--all] [--tags] [-f | --force] <repository> [<refspec>...]";
1212

13-
static int all = 0, tags = 0, force = 0, thin = 1;
14-
static const char *execute = NULL;
13+
static int all, tags, force, thin = 1;
14+
static const char *execute;
1515

1616
#define BUF_SIZE (2084)
1717
static char buffer[BUF_SIZE];
1818

19-
static const char **refspec = NULL;
20-
static int refspec_nr = 0;
19+
static const char **refspec;
20+
static int refspec_nr;
2121

2222
static void add_refspec(const char *ref)
2323
{

0 commit comments

Comments
 (0)