-CFLAGS=-g
+CFLAGS=-g -O3 -Wall
CC=gcc
PROG=update-cache show-diff init-db write-tree read-tree commit-tree cat-file
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>");
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);
}
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;
int main(int argc, char **argv)
{
- int fd;
unsigned char sha1[20];
if (argc != 2)
struct stat st;
struct cache_entry *ce = active_cache[i];
int n, changed;
- unsigned int mode;
unsigned long size;
char type[20];
void *new;
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;
}
int main(int argc, char **argv)
{
- unsigned long size, offset, val;
+ unsigned long size, offset;
int i, entries = read_cache();
char *buffer;