summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bf0c6e8)
raw | patch | inline | side by side (parent: bf0c6e8)
author | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Fri, 8 Apr 2005 16:59:28 +0000 (09:59 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Fri, 8 Apr 2005 16:59:28 +0000 (09:59 -0700) |
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 ;)
clean from early on.
Not that the code is very beautiful anyway ;)
Makefile | patch | blob | history | |
cat-file.c | patch | blob | history | |
init-db.c | patch | blob | history | |
read-cache.c | patch | blob | history | |
read-tree.c | patch | blob | history | |
show-diff.c | patch | blob | history | |
update-cache.c | patch | blob | history | |
write-tree.c | patch | blob | history |
diff --git a/Makefile b/Makefile
index a6bba79ba1f46a1bbf7773449c3bd2bb9bf48e8b..6a0a1c958fa2a1a7020c958e1f7337bd3b86a9f8 100644 (file)
--- a/Makefile
+++ b/Makefile
-CFLAGS=-g
+CFLAGS=-g -O3 -Wall
CC=gcc
PROG=update-cache show-diff init-db write-tree read-tree commit-tree cat-file
diff --git a/cat-file.c b/cat-file.c
index 3071672c6ce2ffb7c1c7d43c1a728f8e020e296b..3829fb6097ad9840cca7654f0b8a718100d590ac 100644 (file)
--- a/cat-file.c
+++ b/cat-file.c
char type[20];
void *buf;
unsigned long size;
- int fd;
if (argc != 3 || get_sha1_hex(argv[2], sha1))
usage("cat-file: cat-file [-t | tagname] <sha1>");
diff --git a/init-db.c b/init-db.c
index bc65086368b44f37a8c7e47734e5b0dffed8873c..1fcef0b373ccec8693ffab22adfe94f4f3c5b86d 100644 (file)
--- a/init-db.c
+++ b/init-db.c
int main(int argc, char **argv)
{
char *sha1_dir = getenv(DB_ENVIRONMENT), *path;
- int len, i, fd;
+ int len, i;
if (mkdir(".dircache", 0700) < 0) {
perror("unable to create .dircache");
if (sha1_dir) {
struct stat st;
if (!stat(sha1_dir, &st) < 0 && S_ISDIR(st.st_mode))
- return;
+ return 0;
fprintf(stderr, "DB_ENVIRONMENT set to bad directory %s: ", sha1_dir);
}
diff --git a/read-cache.c b/read-cache.c
index b151981c1b3d15da75411c2af856958d06138c30..60a0b5b2e78f403047f3a5e2cac1c5c7965091a1 100644 (file)
--- a/read-cache.c
+++ b/read-cache.c
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);
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)
if (fd < 0)
return (errno == ENOENT) ? 0 : error("open failed");
+ size = 0; // avoid gcc warning
map = (void *)-1;
if (!fstat(fd, &st)) {
map = NULL;
diff --git a/read-tree.c b/read-tree.c
index 3785e259756b4b1f396baabcff07a9bcb6f75ddc..af486ff33f6f66323b25efc5ce9e3540d5f5bab9 100644 (file)
--- a/read-tree.c
+++ b/read-tree.c
int main(int argc, char **argv)
{
- int fd;
unsigned char sha1[20];
if (argc != 2)
diff --git a/show-diff.c b/show-diff.c
index e7aa60b4ab92ab2d0fe6afaeb5657757d0401225..3c6d4f98b48634d63554821b8d23592e359f8c91 100644 (file)
--- a/show-diff.c
+++ b/show-diff.c
struct stat st;
struct cache_entry *ce = active_cache[i];
int n, changed;
- unsigned int mode;
unsigned long size;
char type[20];
void *new;
diff --git a/update-cache.c b/update-cache.c
index 0bcd5d408191333e70f54fbf28676a7e3696ced5..413e09d48fa0aad26ef4863a47e1c75c08844d81 100644 (file)
--- a/update-cache.c
+++ b/update-cache.c
if (pos < active_nr)
memmove(active_cache + pos, active_cache + pos + 1, (active_nr - pos - 1) * sizeof(struct cache_entry *));
}
+ return 0;
}
static int add_cache_entry(struct cache_entry *ce)
return 0;
out:
unlink(".dircache/index.lock");
+ return 0;
}
diff --git a/write-tree.c b/write-tree.c
index 012eeeff1b5dd90149ebcd9eed139698c9fab035..6e531b40a84914cf1b37e12f8629fecbec0ae041 100644 (file)
--- a/write-tree.c
+++ b/write-tree.c
int main(int argc, char **argv)
{
- unsigned long size, offset, val;
+ unsigned long size, offset;
int i, entries = read_cache();
char *buffer;