Commit 2256993b27260cd7860c34b47751dff21a7083a8

Stefan Sperling 2019-07-15T12:50:29

avoid dependency on delta.o in binaries which don't need it

diff --git a/lib/delta.c b/lib/delta.c
index 2bed534..42f628d 100644
--- a/lib/delta.c
+++ b/lib/delta.c
@@ -58,13 +58,6 @@ got_delta_open(off_t offset, size_t tslen, int type, size_t size,
 	return delta;
 }
 
-void
-got_delta_close(struct got_delta *delta)
-{
-	free(delta->delta_buf);
-	free(delta);
-}
-
 const struct got_error *
 got_delta_chain_get_base_type(int *type, struct got_delta_chain *deltas)
 {
diff --git a/lib/got_lib_delta.h b/lib/got_lib_delta.h
index a2cb4a3..8b79413 100644
--- a/lib/got_lib_delta.h
+++ b/lib/got_lib_delta.h
@@ -34,7 +34,6 @@ struct got_delta_chain {
 
 struct got_delta *got_delta_open(off_t, size_t, int, size_t, off_t,
     uint8_t *, size_t);
-void got_delta_close(struct got_delta *);
 const struct got_error *got_delta_chain_get_base_type(int *,
     struct got_delta_chain *);
 const struct got_error *got_delta_get_sizes(uint64_t *, uint64_t *,
diff --git a/lib/object_parse.c b/lib/object_parse.c
index d924810..75a7a67 100644
--- a/lib/object_parse.c
+++ b/lib/object_parse.c
@@ -113,7 +113,8 @@ got_object_close(struct got_object *obj)
 		while (!SIMPLEQ_EMPTY(&obj->deltas.entries)) {
 			delta = SIMPLEQ_FIRST(&obj->deltas.entries);
 			SIMPLEQ_REMOVE_HEAD(&obj->deltas.entries, entry);
-			got_delta_close(delta);
+			free(delta->delta_buf);
+			free(delta);
 		}
 	}
 	if (obj->flags & GOT_OBJ_FLAG_PACKED)
diff --git a/libexec/got-read-blob/Makefile b/libexec/got-read-blob/Makefile
index ad08409..a946ea4 100644
--- a/libexec/got-read-blob/Makefile
+++ b/libexec/got-read-blob/Makefile
@@ -1,7 +1,7 @@
 .PATH:${.CURDIR}/../../lib
 
 PROG=		got-read-blob
-SRCS=		got-read-blob.c delta.c error.c inflate.c object_parse.c \
+SRCS=		got-read-blob.c error.c inflate.c object_parse.c \
 		path.c privsep.c sha1.c
 
 CPPFLAGS = -I${.CURDIR}/../../include -I${.CURDIR}/../../lib
diff --git a/libexec/got-read-commit/Makefile b/libexec/got-read-commit/Makefile
index 2786410..c08ff1e 100644
--- a/libexec/got-read-commit/Makefile
+++ b/libexec/got-read-commit/Makefile
@@ -1,7 +1,7 @@
 .PATH:${.CURDIR}/../../lib
 
 PROG=		got-read-commit
-SRCS=		got-read-commit.c delta.c error.c inflate.c object_parse.c \
+SRCS=		got-read-commit.c error.c inflate.c object_parse.c \
 		path.c privsep.c sha1.c
 
 CPPFLAGS = -I${.CURDIR}/../../include -I${.CURDIR}/../../lib
diff --git a/libexec/got-read-object/Makefile b/libexec/got-read-object/Makefile
index da7839d..5936393 100644
--- a/libexec/got-read-object/Makefile
+++ b/libexec/got-read-object/Makefile
@@ -1,7 +1,7 @@
 .PATH:${.CURDIR}/../../lib
 
 PROG=		got-read-object
-SRCS=		got-read-object.c delta.c error.c inflate.c object_parse.c \
+SRCS=		got-read-object.c error.c inflate.c object_parse.c \
 		path.c privsep.c sha1.c
 
 CPPFLAGS = -I${.CURDIR}/../../include -I${.CURDIR}/../../lib
diff --git a/libexec/got-read-tag/Makefile b/libexec/got-read-tag/Makefile
index 3526b16..0d2ce55 100644
--- a/libexec/got-read-tag/Makefile
+++ b/libexec/got-read-tag/Makefile
@@ -1,7 +1,7 @@
 .PATH:${.CURDIR}/../../lib
 
 PROG=		got-read-tag
-SRCS=		got-read-tag.c delta.c error.c inflate.c object_parse.c \
+SRCS=		got-read-tag.c error.c inflate.c object_parse.c \
 		path.c privsep.c sha1.c
 
 CPPFLAGS = -I${.CURDIR}/../../include -I${.CURDIR}/../../lib
diff --git a/libexec/got-read-tree/Makefile b/libexec/got-read-tree/Makefile
index 2d7e641..829da95 100644
--- a/libexec/got-read-tree/Makefile
+++ b/libexec/got-read-tree/Makefile
@@ -1,7 +1,7 @@
 .PATH:${.CURDIR}/../../lib
 
 PROG=		got-read-tree
-SRCS=		got-read-tree.c delta.c error.c inflate.c object_parse.c \
+SRCS=		got-read-tree.c error.c inflate.c object_parse.c \
 		path.c privsep.c sha1.c
 
 CPPFLAGS = -I${.CURDIR}/../../include -I${.CURDIR}/../../lib
diff --git a/regress/idset/Makefile b/regress/idset/Makefile
index 9b1d3ab..3783d35 100644
--- a/regress/idset/Makefile
+++ b/regress/idset/Makefile
@@ -1,11 +1,7 @@
 .PATH:${.CURDIR}/../../lib
 
 PROG = idset_test
-SRCS = error.c object.c privsep.c sha1.c pack.c inflate.c path.c opentemp.c \
-	delta.c repository.c reference.c worktree.c fileindex.c object_cache.c \
-	object_idset.c object_parse.c idset_test.c \
-	buf.c worklist.c rcsutil.c diff.c diffreg.c diff3.c lockfile.c \
-	deflate.c object_create.c
+SRCS = error.c sha1.c object_idset.c inflate.c object_parse.c idset_test.c
 
 CPPFLAGS = -I${.CURDIR}/../../include -I${.CURDIR}/../../lib
 LDADD = -lutil -lz