Re: [PATCH 06/18] streaming: create structure for in-core object streams
Patrick Steinhardt <ps@pks.im> writes:
Show 12 quoted lines
> @@ -426,22 +429,24 @@ static int open_istream_incore(struct odb_read_stream **out,
> const struct object_id *oid)
> {
> struct object_info oi = OBJECT_INFO_INIT;
> - struct odb_read_stream stream = {
> - .close = close_istream_incore,
> - .read = read_istream_incore,
> - };
> + struct odb_incore_read_stream stream = {
> + .base.close = close_istream_incore,
> + .base.read = read_istream_incore,
> + }, *st;Nit: Almost missed this `*st`. I wonder if its more readable as a
separate line:
struct odb_incore_read_stream *st;
All good otherwise.
Show 25 quoted lines
> int ret;
>
> - oi.typep = &stream.type;
> - oi.sizep = &stream.size;
> - oi.contentp = (void **)&stream.u.incore.buf;
> + oi.typep = &stream.base.type;
> + oi.sizep = &stream.base.size;
> + oi.contentp = (void **)&stream.buf;
> ret = odb_read_object_info_extended(r->objects, oid, &oi,
> OBJECT_INFO_DIE_IF_CORRUPT);
> if (ret)
> return ret;
>
> - CALLOC_ARRAY(*out, 1);
> - **out = stream;
> + CALLOC_ARRAY(st, 1);
> + *st = stream;
> + *out = &st->base;
> +
> return 0;
> }
>
>
> --
> 2.52.0.rc2.482.gaa765fefd0.dirty