Commit Diff


commit - 0af444f5444a6b3b062b6613bbaf4e6d44c6c25c
commit + 31f4c1e6659c2fbc73b69effcd47acca428c1c34
blob - 9550b434026142279a5994c04041865d05256b60
blob + 0115e7b78c440326e9e91c010a967b702ff8432f
--- lib/got_lib_object.h
+++ lib/got_lib_object.h
@@ -40,8 +40,6 @@ struct got_raw_object {
 	uint8_t *data;
 	off_t size;
 	size_t hdrlen;
-	size_t blocksize;
-	uint8_t *read_buf;
 	int refcnt;		/* > 0 if open and/or cached */
 };
 
@@ -108,7 +106,7 @@ const struct got_error *got_object_read_header_privsep
 const struct got_error *got_object_open(struct got_object **,
     struct got_repository *, struct got_object_id *);
 const struct got_error *got_object_raw_open(struct got_raw_object **, int *,
-    struct got_repository *, struct got_object_id *, size_t);
+    struct got_repository *, struct got_object_id *);
 const struct got_error *got_object_raw_close(struct got_raw_object *);
 const struct got_error *got_object_open_by_id_str(struct got_object **,
     struct got_repository *, const char *);
blob - a6900432a89dcb070e53a9eb4dc3d7580fb28724
blob + 29ea30e10bd9622eac9d105e0f8999912a726c9d
--- lib/object.c
+++ lib/object.c
@@ -531,7 +531,7 @@ got_object_open(struct got_object **obj, struct got_re
 /* *outfd must be initialized to -1 by caller */
 const struct got_error *
 got_object_raw_open(struct got_raw_object **obj, int *outfd,
-    struct got_repository *repo, struct got_object_id *id, size_t blocksize)
+    struct got_repository *repo, struct got_object_id *id)
 {
 	const struct got_error *err = NULL;
 	struct got_packidx *packidx = NULL;
@@ -591,12 +591,6 @@ got_object_raw_open(struct got_raw_object **obj, int *
 		goto done;
 	}
 
-	(*obj)->read_buf = malloc(blocksize);
-	if ((*obj)->read_buf == NULL) {
-		err = got_error_from_errno("malloc");
-		goto done;
-	}
-
 	if (outbuf) {
 		(*obj)->f = fmemopen(outbuf, hdrlen + size, "r");
 		if ((*obj)->f == NULL) {
@@ -626,7 +620,6 @@ got_object_raw_open(struct got_raw_object **obj, int *
 	}
 	(*obj)->hdrlen = hdrlen;
 	(*obj)->size = size;
-	(*obj)->blocksize = blocksize;
 	err = got_repo_cache_raw_object(repo, id, *obj);
 done:
 	free(path_packfile);
blob - c1a34dc79d27cbb721f95e952200e227cb3b1725
blob + b78b7ba3c8fbd3036ee95c115be0ea37323e9496
--- lib/object_parse.c
+++ lib/object_parse.c
@@ -144,7 +144,6 @@ got_object_raw_close(struct got_raw_object *obj)
 			return NULL;
 	}
 
-	free(obj->read_buf);
 	if (obj->f != NULL && fclose(obj->f) == EOF && err == NULL)
 		err = got_error_from_errno("fclose");
 	free(obj->data);
blob - 639dc548bf0415c7b1b50728db0c89e1aa71c872
blob + 1f5a114797aaf64af813a2fd8917298bfe14f048
--- lib/pack_create.c
+++ lib/pack_create.c
@@ -193,7 +193,7 @@ pick_deltas(struct got_pack_meta **meta, int nmeta, in
 		    m->obj_type == GOT_OBJ_TYPE_TAG)
 			continue;
 
-		err = got_object_raw_open(&raw, &outfd, repo, &m->id, 8192);
+		err = got_object_raw_open(&raw, &outfd, repo, &m->id);
 		if (err)
 			goto done;
 		m->size = raw->size;
@@ -224,7 +224,7 @@ pick_deltas(struct got_pack_meta **meta, int nmeta, in
 				continue;
 
 			err = got_object_raw_open(&base_raw, &outfd, repo,
-			    &base->id, 8192);
+			    &base->id);
 			if (err)
 				goto done;
 			err = got_deltify(&deltas, &ndeltas,
@@ -1157,7 +1157,7 @@ genpack(uint8_t *pack_sha1, FILE *packfile,
 		}
 		m = meta[i];
 		m->off = ftello(packfile);
-		err = got_object_raw_open(&raw, &outfd, repo, &m->id, 8192);
+		err = got_object_raw_open(&raw, &outfd, repo, &m->id);
 		if (err)
 			goto done;
 		if (m->deltas == NULL) {