From 39a57bc42d4e51b98f4028ccd1cd5adc8299792e Mon Sep 17 00:00:00 2001 From: Robert Spalek Date: Mon, 28 Jun 2004 12:53:34 +0000 Subject: [PATCH] - obj_read_bucket() takes a new parameter: struct mempool *pool - buck2obj_alloc() takes no parameters at all now --- lib/buck2obj.c | 14 +++----------- lib/buck2obj.h | 5 ++--- lib/buckettool.c | 5 ++--- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/buck2obj.c b/lib/buck2obj.c index f268e11a..fa787022 100644 --- a/lib/buck2obj.c +++ b/lib/buck2obj.c @@ -28,16 +28,14 @@ struct buck2obj_buf { bb_t bb; struct lizard_buffer *lizard; - struct mempool *mp; }; struct buck2obj_buf * -buck2obj_alloc(struct mempool *mp) +buck2obj_alloc(void) { struct buck2obj_buf *buf = xmalloc(sizeof(struct buck2obj_buf)); bb_init(&buf->bb); buf->lizard = lizard_alloc(); - buf->mp = mp; return buf; } @@ -49,12 +47,6 @@ buck2obj_free(struct buck2obj_buf *buf) xfree(buf); } -void -buck2obj_flush(struct buck2obj_buf *buf) -{ - mp_flush(buf->mp); -} - static inline byte * decode_attributes(byte *ptr, byte *end, struct odes *o, uns can_overwrite) { @@ -92,9 +84,9 @@ decode_attributes(byte *ptr, byte *end, struct odes *o, uns can_overwrite) } struct odes * -obj_read_bucket(struct buck2obj_buf *buf, uns buck_type, uns buck_len, struct fastbuf *body, uns *body_start) +obj_read_bucket(struct buck2obj_buf *buf, struct mempool *pool, uns buck_type, uns buck_len, struct fastbuf *body, uns *body_start) { - struct odes *o = obj_new(buf->mp); + struct odes *o = obj_new(pool); if (buck_type < BUCKET_TYPE_V33) { diff --git a/lib/buck2obj.h b/lib/buck2obj.h index 86762a8e..24a4815f 100644 --- a/lib/buck2obj.h +++ b/lib/buck2obj.h @@ -7,10 +7,9 @@ struct buck2obj_buf; struct mempool; -struct buck2obj_buf *buck2obj_alloc(struct mempool *mp); +struct buck2obj_buf *buck2obj_alloc(void); void buck2obj_free(struct buck2obj_buf *buf); -void buck2obj_flush(struct buck2obj_buf *buf); -struct odes *obj_read_bucket(struct buck2obj_buf *buf, uns buck_type, uns buck_len, struct fastbuf *body, uns *body_start); +struct odes *obj_read_bucket(struct buck2obj_buf *buf, struct mempool *pool, uns buck_type, uns buck_len, struct fastbuf *body, uns *body_start); /* If body_start != NULL, then only the header is parsed and *body_start is * set to the position of the body. The fastbuf is never overwritten when * parsing a header. diff --git a/lib/buckettool.c b/lib/buckettool.c index 81b252f8..a7900522 100644 --- a/lib/buckettool.c +++ b/lib/buckettool.c @@ -102,8 +102,7 @@ dump_oattr(struct fastbuf *out, struct oattr *oa) static void dump_parsed_bucket(struct fastbuf *out, struct obuck_header *h, struct fastbuf *b) { - mp_flush(pool); - struct odes *o = obj_read_bucket(buck_buf, h->type, h->length, b, NULL); + struct odes *o = obj_read_bucket(buck_buf, pool, h->type, h->length, b, NULL); if (!o) bprintf(out, "Cannot parse bucket %x of type %x and length %d: %m\n", h->oid, h->type, h->length); else @@ -417,7 +416,7 @@ main(int argc, char **argv) if (!raw) { pool = mp_new(1<<14); - buck_buf = buck2obj_alloc(pool); + buck_buf = buck2obj_alloc(); } switch (op) { -- 2.39.2