Code

n is in fact unused, and is later shadowed.
[git.git] / builtin-apply.c
index 4573c9abb214c6f7b3119b6e7f594c5ddf09162b..f8f5eebd2f9b6ebbad46e8d86efde535f30a194f 100644 (file)
@@ -28,18 +28,18 @@ static int prefix_length = -1;
 static int newfd = -1;
 
 static int p_value = 1;
-static int allow_binary_replacement = 0;
-static int check_index = 0;
-static int write_index = 0;
-static int cached = 0;
-static int diffstat = 0;
-static int numstat = 0;
-static int summary = 0;
-static int check = 0;
+static int allow_binary_replacement;
+static int check_index;
+static int write_index;
+static int cached;
+static int diffstat;
+static int numstat;
+static int summary;
+static int check;
 static int apply = 1;
-static int apply_in_reverse = 0;
-static int no_add = 0;
-static int show_index_info = 0;
+static int apply_in_reverse;
+static int no_add;
+static int show_index_info;
 static int line_termination = '\n';
 static unsigned long p_context = -1;
 static const char apply_usage[] =
@@ -51,10 +51,10 @@ static enum whitespace_eol {
        error_on_whitespace,
        strip_whitespace,
 } new_whitespace = warn_on_whitespace;
-static int whitespace_error = 0;
+static int whitespace_error;
 static int squelch_whitespace_errors = 5;
-static int applied_after_stripping = 0;
-static const char *patch_input_file = NULL;
+static int applied_after_stripping;
+static const char *patch_input_file;
 
 static void parse_whitespace_option(const char *option)
 {
@@ -606,9 +606,7 @@ static char *git_header_name(char *line, int llen)
         * form.
         */
        for (len = 0 ; ; len++) {
-               char c = name[len];
-
-               switch (c) {
+               switch (name[len]) {
                default:
                        continue;
                case '\n':
@@ -1684,7 +1682,7 @@ static int apply_binary(struct buffer_desc *desc, struct patch *patch)
        }
 
        get_sha1_hex(patch->new_sha1_prefix, sha1);
-       if (!memcmp(sha1, null_sha1, 20)) {
+       if (is_null_sha1(sha1)) {
                free(desc->buffer);
                desc->alloc = desc->size = 0;
                desc->buffer = NULL;
@@ -1907,18 +1905,13 @@ static int check_patch(struct patch *patch, struct patch *prev_patch)
 static int check_patch_list(struct patch *patch)
 {
        struct patch *prev_patch = NULL;
-       int error = 0;
+       int err = 0;
 
        for (prev_patch = NULL; patch ; patch = patch->next) {
-               error |= check_patch(patch, prev_patch);
+               err |= check_patch(patch, prev_patch);
                prev_patch = patch;
        }
-       return error;
-}
-
-static inline int is_null_sha1(const unsigned char *sha1)
-{
-       return !memcmp(sha1, null_sha1, 20);
+       return err;
 }
 
 static void show_index_list(struct patch *list)