Skip to content

Commit 3310048

Browse files
0xAXgitster
authored andcommitted
cat-file: use "type" and "size" from outer scope
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fdf96a2 commit 3310048

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

builtin/cat-file.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
7979
if (type_from_string(exp_type) == OBJ_BLOB) {
8080
unsigned char blob_sha1[20];
8181
if (sha1_object_info(sha1, NULL) == OBJ_TAG) {
82-
enum object_type type;
83-
unsigned long size;
8482
char *buffer = read_sha1_file(sha1, &type, &size);
8583
const char *target;
8684
if (!skip_prefix(buffer, "object ", &target) ||

0 commit comments

Comments
 (0)