Skip to content

Commit

Permalink
cat-file: use "type" and "size" from outer scope
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexander Kuleshov authored and Junio C Hamano committed Jan 13, 2015
1 parent fdf96a2 commit 3310048
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions builtin/cat-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) ||
Expand Down

0 comments on commit 3310048

Please sign in to comment.