cat-file: use "type" and "size" from outer scope
authorAlexander Kuleshov <kuleshovmail@gmail.com>
Sat, 10 Jan 2015 18:13:23 +0000 (00:13 +0600)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Jan 2015 20:36:04 +0000 (12:36 -0800)
In cat_one_file(), "type" and "size" variables are defined in the
function scope, and then two variables of the same name are defined
in a block in one of the if/else statement, hiding the definitions
in the outer scope.

Because the values of the outer variables before the control enters
this scope, however, do not have to be preserved, we can remove
useless definitions of variables from the inner scope safely without
breaking anything.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/cat-file.c
index f8d81291b9913a769f79405720210aa4eaf6daee..5e24e811ee93d33180d4e3a19a21989b31169c56 100644 (file)
@@ -79,8 +79,6 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
                if (type_from_string(exp_type) == OBJ_BLOB) {
                        unsigned char blob_sha1[20];
                        if (sha1_object_info(sha1, NULL) == OBJ_TAG) {
-                               enum object_type type;
-                               unsigned long size;
                                char *buffer = read_sha1_file(sha1, &type, &size);
                                const char *target;
                                if (!skip_prefix(buffer, "object ", &target) ||