]> mj.ucw.cz Git - libucw.git/commitdiff
- obj_read_bucket() takes a new parameter: struct mempool *pool
authorRobert Spalek <robert@ucw.cz>
Mon, 28 Jun 2004 12:53:34 +0000 (12:53 +0000)
committerRobert Spalek <robert@ucw.cz>
Mon, 28 Jun 2004 12:53:34 +0000 (12:53 +0000)
- buck2obj_alloc() takes no parameters at all now

lib/buck2obj.c
lib/buck2obj.h
lib/buckettool.c

index f268e11a0e5c7772aa9af3d984401c0560e94ef7..fa787022f315c61c1be3345d186427a55ddae60d 100644 (file)
@@ -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)
   {
index 86762a8ec581f0c6d834305b8464191a7c74abdb..24a4815f01d2675756c051a763ee5a25c5e2c08a 100644 (file)
@@ -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.
index 81b252f8eed6538cd6955eeae79cef735e9842eb..a79005221ed9c51c62747ac8e956a29fe17fd640 100644 (file)
@@ -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)
     {