Skip to content

Commit

Permalink
Avoid gcc warnings in sha1_file.c
Browse files Browse the repository at this point in the history
A couple of bogus "might be used undefined" warnings are avoided
by moving the initializations unnecessarily early.
  • Loading branch information
Linus Torvalds committed Jul 3, 2005
1 parent 8a65ff7 commit 4d235c8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ static int check_packed_git_idx(const char *path, unsigned long *idx_size_,
return -1;

index = idx_map;
*idx_map_ = idx_map;
*idx_size_ = idx_size;

/* check index map */
if (idx_size < 4*256 + 20 + 20)
Expand All @@ -316,8 +318,6 @@ static int check_packed_git_idx(const char *path, unsigned long *idx_size_,
if (idx_size != 4*256 + nr * 24 + 20 + 20)
return error("wrong index file size");

*idx_map_ = idx_map;
*idx_size_ = idx_size;
return 0;
}

Expand Down Expand Up @@ -857,7 +857,7 @@ static void *unpack_non_delta_entry(unsigned char *data,
{
int st;
z_stream stream;
char *buffer;
unsigned char *buffer;

buffer = xmalloc(size + 1);
buffer[size] = 0;
Expand Down Expand Up @@ -949,7 +949,7 @@ int nth_packed_object_sha1(const struct packed_git *p, int n,
int find_pack_entry_one(const unsigned char *sha1,
struct pack_entry *e, struct packed_git *p)
{
int *level1_ofs = p->index_base;
unsigned int *level1_ofs = p->index_base;
int hi = ntohl(level1_ofs[*sha1]);
int lo = ((*sha1 == 0x0) ? 0 : ntohl(level1_ofs[*sha1 - 1]));
void *index = p->index_base + 256;
Expand Down

0 comments on commit 4d235c8

Please sign in to comment.