Commit aea5f015fdc344c7da6ba4b979b37afe0cac8004

Stefan Sperling 2018-12-24T14:29:50

drop dead code from got_privsep_send_obj_req()

diff --git a/lib/got_lib_privsep.h b/lib/got_lib_privsep.h
index dc25646..265fdf3 100644
--- a/lib/got_lib_privsep.h
+++ b/lib/got_lib_privsep.h
@@ -217,8 +217,7 @@ const struct got_error *got_privsep_send_stop(int);
 const struct got_error *got_privsep_recv_imsg(struct imsg *, struct imsgbuf *,
     size_t);
 void got_privsep_send_error(struct imsgbuf *, const struct got_error *);
-const struct got_error *got_privsep_send_obj_req(struct imsgbuf *, int,
-    struct got_object *);
+const struct got_error *got_privsep_send_obj_req(struct imsgbuf *, int);
 const struct got_error *got_privsep_send_commit_req(struct imsgbuf *, int,
     struct got_object_id *, int);
 const struct got_error *got_privsep_send_tree_req(struct imsgbuf *, int,
diff --git a/lib/object.c b/lib/object.c
index 9ce82be..d504c3c 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -345,7 +345,7 @@ request_object(struct got_object **obj, struct got_repository *repo, int fd)
 
 	ibuf = repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_OBJECT].ibuf;
 
-	err = got_privsep_send_obj_req(ibuf, fd, NULL);
+	err = got_privsep_send_obj_req(ibuf, fd);
 	if (err)
 		return err;
 
diff --git a/lib/privsep.c b/lib/privsep.c
index 0ae91bf..8d41f1b 100644
--- a/lib/privsep.c
+++ b/lib/privsep.c
@@ -221,45 +221,10 @@ got_privsep_send_stop(int fd)
 }
 
 const struct got_error *
-got_privsep_send_obj_req(struct imsgbuf *ibuf, int fd, struct got_object *obj)
+got_privsep_send_obj_req(struct imsgbuf *ibuf, int fd)
 {
-	struct got_imsg_object iobj, *iobjp = NULL;
-	size_t iobj_size = 0;
-	int imsg_code = GOT_IMSG_OBJECT_REQUEST;
-
-	if (obj) {
-		switch (obj->type) {
-		case GOT_OBJ_TYPE_TREE:
-			imsg_code = GOT_IMSG_TREE_REQUEST;
-			break;
-		case GOT_OBJ_TYPE_COMMIT:
-			abort(); /* should not get here */
-			break;
-		case GOT_OBJ_TYPE_BLOB:
-			imsg_code = GOT_IMSG_BLOB_REQUEST;
-			break;
-		case GOT_OBJ_TYPE_TAG:
-			imsg_code = GOT_IMSG_TAG_REQUEST;
-			break;
-		default:
-			return got_error(GOT_ERR_OBJ_TYPE);
-		}
-
-		memcpy(iobj.id, obj->id.sha1, sizeof(iobj.id));
-		iobj.type = obj->type;
-		iobj.flags = obj->flags;
-		iobj.hdrlen = obj->hdrlen;
-		iobj.size = obj->size;
-		if (iobj.flags & GOT_OBJ_FLAG_PACKED) {
-			iobj.pack_offset = obj->pack_offset;
-			iobj.pack_idx = obj->pack_idx;
-		}
-
-		iobjp = &iobj;
-		iobj_size = sizeof(iobj);
-	}
-
-	if (imsg_compose(ibuf, imsg_code, 0, 0, fd, iobjp, iobj_size) == -1)
+	if (imsg_compose(ibuf, GOT_IMSG_OBJECT_REQUEST, 0, 0, fd, NULL, 0)
+	    == -1)
 		return got_error_from_errno();
 
 	return flush_imsg(ibuf);