commit - 1eda26823a5463fc2e82f0a05f454faf2ac46e65
commit + ebe6ec920b98ddf1b63687d78857f37af34b691f
blob - f0d614fbd97c672d8ebb6442ea09ea11e0d3e929
blob + 0272a5dfbad3568d5ae28e7d1c782d936770da89
--- lib/got_lib_object.h
+++ lib/got_lib_object.h
struct got_packidx *, struct got_repository *);
const struct got_error *got_object_raw_alloc(struct got_raw_object **,
- uint8_t *, int *, size_t, off_t);
+ uint8_t *, int *, size_t, size_t, off_t);
blob - 7f8aab974739cfe608a3529016cc5bb9b627a33c
blob + 358d74b8bcbd7a84add024a4336f30c10be59dd0
--- lib/object.c
+++ lib/object.c
const struct got_error *
got_object_raw_alloc(struct got_raw_object **obj, uint8_t *outbuf, int *outfd,
- size_t hdrlen, off_t size)
+ size_t max_in_mem_size, size_t hdrlen, off_t size)
{
const struct got_error *err = NULL;
off_t tot;
goto done;
}
#ifndef GOT_PACK_NO_MMAP
- if (tot > 0 && tot <= SIZE_MAX) {
+ if (tot > 0 && tot <= max_in_mem_size) {
(*obj)->data = mmap(NULL, tot, PROT_READ,
MAP_PRIVATE, *outfd, 0);
if ((*obj)->data == MAP_FAILED) {
blob - a03f6638af6fa2dafb07d148594a09931cb82389
blob + 312719b3bcc84abe056dab97015657c4a30442f6
--- lib/object_open_io.c
+++ lib/object_open_io.c
goto done;
}
- err = got_object_raw_alloc(obj, outbuf, outfd, hdrlen, size);
+ err = got_object_raw_alloc(obj, outbuf, outfd,
+ GOT_DELTA_RESULT_SIZE_CACHED_MAX, hdrlen, size);
if (err)
goto done;
blob - 02dce25c61922e6ad96140eb46495db6300edb53
blob + 5c3519f8f414adc10d3f24f30cda57b165000539
--- lib/object_open_privsep.c
+++ lib/object_open_privsep.c
goto done;
}
- err = got_object_raw_alloc(obj, outbuf, outfd, hdrlen, size);
+ err = got_object_raw_alloc(obj, outbuf, outfd,
+ GOT_DELTA_RESULT_SIZE_CACHED_MAX, hdrlen, size);
if (err)
goto done;