aboutsummaryrefslogtreecommitdiffstats
path: root/read-cache.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-08 09:59:28 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-08 09:59:28 -0700
commit19b2860cba5742ab31fd682b80fefefac19be141 (patch)
tree406548bda4dfb72566db6e515e38604a7641ec15 /read-cache.c
parentbf0c6e839c692142784caf07b523cd69442e57a5 (diff)
downloadgit-19b2860cba5742ab31fd682b80fefefac19be141.tar.gz
Use "-Wall -O2" for the compiler to get more warnings.
And fix up the warnings that it pointed out. Let's keep the tree clean from early on. Not that the code is very beautiful anyway ;)
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/read-cache.c b/read-cache.c
index b151981c1b..60a0b5b2e7 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -89,7 +89,7 @@ void * read_sha1_file(unsigned char *sha1, char *type, unsigned long *size)
z_stream stream;
char buffer[8192];
struct stat st;
- int i, fd, ret, bytes;
+ int fd, ret, bytes;
void *map, *buf;
char *filename = sha1_file_name(sha1);
@@ -173,7 +173,7 @@ int write_sha1_file(char *buf, unsigned len)
int write_sha1_buffer(unsigned char *sha1, void *buf, unsigned int size)
{
char *filename = sha1_file_name(sha1);
- int i, fd;
+ int fd;
fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0666);
if (fd < 0)
@@ -228,6 +228,7 @@ int read_cache(void)
if (fd < 0)
return (errno == ENOENT) ? 0 : error("open failed");
+ size = 0; // avoid gcc warning
map = (void *)-1;
if (!fstat(fd, &st)) {
map = NULL;