Commit Diff


commit - 5c860e2997733fa54f69d9b201bc1cf49a3f78b8
commit + 25783624d6d0848cf127e112e4b7648265a35ca4
blob - e8a9594dc6bfdc9057b7fabc1fcfcda43b0ea4af
blob + 0d03e126ff7964bff61f602b55e570eb2f97f80e
--- include/got_error.h
+++ include/got_error.h
@@ -81,5 +81,5 @@ static const struct got_error {
 };
 
 const struct got_error * got_error(int code);
-const struct got_error *got_error_from_errno();
+const struct got_error *got_error_from_errno(void);
 const struct got_error *got_ferror(FILE *, int);
blob - 1a90ea1636849c048da1dabbca508c93bf1c720c
blob + 0cc46638942f0cf3f2194553f0cf7bbf7fb47cef
--- lib/diff.c
+++ lib/diff.c
@@ -359,9 +359,7 @@ static const struct got_error *
 diff_entry_old_new(struct got_tree_entry *te1, struct got_tree_object *tree2,
     struct got_repository *repo, FILE *outfile)
 {
-	const struct got_error *err;
 	struct got_tree_entry *te2;
-	char hex[SHA1_DIGEST_STRING_LENGTH];
 
 	te2 = match_entry_by_name(te1, tree2);
 	if (te2 == NULL) {
@@ -387,7 +385,6 @@ static const struct got_error *
 diff_entry_new_old(struct got_tree_entry *te2, struct got_tree_object *tree1,
     struct got_repository *repo, FILE *outfile)
 {
-	const struct got_error *err;
 	struct got_tree_entry *te1;
 
 	te1 = match_entry_by_name(te2, tree1);
blob - e7ec8e7d8d8c5b4d680c4939f2a9f8e1512fbe32
blob + 6190d26337bce49d510b0e369d605e9d98aab9ef
--- lib/object.c
+++ lib/object.c
@@ -154,10 +154,9 @@ read_object_header(struct got_object **obj, struct got
 	const struct got_error *err;
 	struct got_zstream_buf zb;
 	char *buf;
-	size_t len;
 	const size_t zbsize = 64;
 	size_t outlen, totlen;
-	int i, ret;
+	int i;
 
 	buf = calloc(zbsize, sizeof(char));
 	if (buf == NULL)
@@ -298,26 +297,6 @@ got_object_close(struct got_object *obj)
 	free(obj);
 }
 
-static int
-commit_object_valid(struct got_commit_object *commit)
-{
-	int i;
-	int n;
-
-	if (commit == NULL)
-		return 0;
-
-	n = 0;
-	for (i = 0; i < SHA1_DIGEST_LENGTH; i++) {
-		if (commit->tree_id->sha1[i] == 0)
-			n++;
-	}
-	if (n == SHA1_DIGEST_LENGTH)
-		return 0;
-
-	return 1;
-}
-
 static const struct got_error *
 parse_commit_object(struct got_commit_object **commit, char *buf, size_t len)
 {
@@ -469,7 +448,6 @@ parse_tree_entry(struct got_tree_entry **te, size_t *e
 {
 	char *p = buf, *space;
 	const struct got_error *err = NULL;
-	char hex[SHA1_DIGEST_STRING_LENGTH];
 
 	*te = calloc(1, sizeof(**te));
 	if (*te == NULL)
@@ -527,7 +505,6 @@ parse_tree_object(struct got_tree_object **tree, struc
 {
 	const struct got_error *err;
 	size_t remain = len;
-	int nentries;
 
 	*tree = calloc(1, sizeof(**tree));
 	if (*tree == NULL)
@@ -612,7 +589,6 @@ read_commit_object(struct got_commit_object **commit,
 	const struct got_error *err = NULL;
 	size_t len;
 	uint8_t *p;
-	int i, ret;
 
 	if (obj->flags & GOT_OBJ_FLAG_PACKED)
 		err = read_to_mem(&p, &len, f);
@@ -682,7 +658,6 @@ read_tree_object(struct got_tree_object **tree,
 	const struct got_error *err = NULL;
 	size_t len;
 	uint8_t *p;
-	int i, ret;
 
 	if (obj->flags & GOT_OBJ_FLAG_PACKED)
 		err = read_to_mem(&p, &len, f);
blob - a10bec55ed58ab61e168b1b4c6314c9e31cf3d00
blob + 1c07f6346b919626ec160b7bcc0acfa4d83b5e21
--- lib/pack.c
+++ lib/pack.c
@@ -302,7 +302,6 @@ get_object_idx(struct got_packidx_v2_hdr *packidx, str
 
 	while (i < totobj) {
 		struct got_object_id *oid = &packidx->sorted_ids[i];
-		uint32_t offset;
 		int cmp = got_object_id_cmp(id, oid);
 
 		if (cmp == 0)
@@ -368,7 +367,6 @@ err:
 static void
 cache_packidx(struct got_packidx_v2_hdr *packidx, struct got_repository *repo)
 {
-	struct got_packidx_v2_hdr *p;
 	int i;
 
 	for (i = 0; i < nitems(repo->packidx_cache); i++) {
@@ -463,10 +461,7 @@ get_packfile_path(char **path_packfile, struct got_rep
 	char *path_packdir;
 	char hex[SHA1_DIGEST_STRING_LENGTH];
 	char *sha1str;
-	char *path_packidx;
 
-	*path_packfile = NULL;
-
 	path_packdir = got_repo_get_path_objects_pack(repo);
 	if (path_packdir == NULL)
 		return got_error(GOT_ERR_NO_MEM);
@@ -810,11 +805,7 @@ open_delta_object(struct got_object **obj, struct got_
     int delta_type, size_t delta_size)
 {
 	const struct got_error *err = NULL;
-	struct got_object_id base_id;
-	uint8_t base_type;
 	int resolved_type;
-	uint64_t base_size;
-	size_t base_tslen;
 
 	*obj = calloc(1, sizeof(**obj));
 	if (*obj == NULL)
blob - 9f0d7007ce89105d2222d28c50ae1edf94c03821
blob + 2359a13f176985e5b421c4923d26b0de468bc6c5
--- lib/path.c
+++ lib/path.c
@@ -66,7 +66,6 @@ got_path_normalize(const char *path)
 const struct got_error *
 got_path_segment_count(int *count, const char *path)
 {
-	int n = 0;
 	char *s = strdup(path), *p;
 
 	*count = 0;
@@ -111,7 +110,7 @@ const struct got_error *
 got_opentemp_named(char **path, FILE **outfile, const char *basepath)
 {
 	const struct got_error *err = NULL;
-	int fd, ret;
+	int fd;
 
 	if (asprintf(path, "%s-XXXXXX", basepath) == -1) {
 		*path = NULL;
blob - 3064e1cfe326c7f47a7e0ab1fbe97b1eb62125c2
blob + 4a5ef20dd3967be4acf3dea7bc45f06864a9f48f
--- lib/refs.c
+++ lib/refs.c
@@ -159,7 +159,6 @@ got_ref_open(struct got_reference **ref, struct got_re
 	const struct got_error *err = NULL;
 	char *path_ref = NULL;
 	char *normpath = NULL;
-	const char *parent_dir;
 	char *path_refs = get_refs_dir_path(repo, refname);
 
 	if (path_refs == NULL) {
@@ -202,8 +201,6 @@ struct got_reference *
 got_ref_dup(struct got_reference *ref)
 {
 	struct got_reference *ret;
-	char *name = NULL;
-	char *symref = NULL;
 
 	ret = calloc(1, sizeof(*ret));
 	if (ret == NULL)
blob - c75207647a9046ebd37a9653eb4955f10606106d
blob + dcdf5a7af79f2a7ba05e0da2f7131c5e2623d3d0
--- lib/zbuf.c
+++ lib/zbuf.c
@@ -152,7 +152,6 @@ got_inflate_to_file(size_t *outlen, FILE *infile, FILE
 	const struct got_error *err;
 	size_t avail;
 	struct got_zstream_buf zb;
-	void *newbuf;
 
 	err = got_inflate_init(&zb, 8192);
 	if (err)
blob - dd454247623767c4d4e65c09c9a876123e36a53f
blob + 0967da59d3efc2b30daf05e0861d351d6bb80739
--- regress/delta/Makefile
+++ regress/delta/Makefile
@@ -6,7 +6,7 @@ SRCS = delta.c error.c path.c zbuf.c delta_test.c
 CPPFLAGS = -I${.CURDIR}/../../include -I${.CURDIR}/../../lib
 LDADD = -lz
 DEBUG = -O0 -g
-CFLAGS += -Werror
+CFLAGS = -Werror -Wall -Wstrict-prototypes -Wunused-variable
 
 NOMAN = yes
 
blob - bba0a308884833e6516a3bc570e9b0c592f98cdf
blob + c54c110488ee7bfb95da2e619b614cc2fa6a8248
--- regress/repository/Makefile
+++ regress/repository/Makefile
@@ -7,7 +7,7 @@ SRCS = path.c repository.c error.c refs.c object.c sha
 CPPFLAGS = -I${.CURDIR}/../../include
 LDADD = -lutil -lz
 DEBUG = -O0 -g
-CFLAGS += -Werror
+CFLAGS = -Werror -Wall -Wstrict-prototypes -Wunused-variable
 
 NOMAN = yes
 
blob - 475cdbc31e78afeb06d3c0758cf5cbe0e371040a
blob + 1d2959d7c776ea9687febe894c1e1a9805064b2a
--- regress/repository/repository_test.c
+++ regress/repository/repository_test.c
@@ -182,7 +182,6 @@ repo_read_log(const char *repo_path)
 	struct got_object_id *id;
 	struct got_object *obj;
 	char *buf;
-	int ret;
 
 	err = got_repo_open(&repo, repo_path);
 	if (err != NULL || repo == NULL)
@@ -221,8 +220,6 @@ repo_read_tree(const char *repo_path)
 	const struct got_error *err;
 	struct got_repository *repo;
 	struct got_object *obj;
-	int i;
-	size_t len;
 
 	err = got_repo_open(&repo, repo_path);
 	if (err != NULL || repo == NULL)
@@ -292,8 +289,6 @@ repo_diff_blob(const char *repo_path)
 	struct got_object *obj2;
 	struct got_blob_object *blob1;
 	struct got_blob_object *blob2;
-	int i;
-	size_t len;
 	FILE *outfile;
 
 	err = got_repo_open(&repo, repo_path);
@@ -348,8 +343,6 @@ repo_diff_tree(const char *repo_path)
 	struct got_object *obj2;
 	struct got_tree_object *tree1;
 	struct got_tree_object *tree2;
-	int i;
-	size_t len;
 	FILE *outfile;
 
 	err = got_repo_open(&repo, repo_path);
@@ -411,7 +404,6 @@ main(int argc, char *argv[])
 	int test_ok = 0, failure = 0;
 	const char *repo_path;
 	int ch;
-	int vflag = 0;
 
 	while ((ch = getopt(argc, argv, "v")) != -1) {
 		switch (ch) {
blob - cb4b123622c451543c9a1a62b6027745ccc179d7
blob + 75af81c5114375f5d995ed0fe39294e659f228f4
--- regress/worktree/Makefile
+++ regress/worktree/Makefile
@@ -7,7 +7,7 @@ SRCS = worktree.c repository.c object.c path.c error.c
 CPPFLAGS = -I${.CURDIR}/../../include -I${.CURDIR}/../../lib
 LDADD = -lutil -lz
 DEBUG = -O0 -g
-CFLAGS += -Werror
+CFLAGS = -Werror -Wall -Wstrict-prototypes -Wunused-variable
 
 NOMAN = yes