summaryrefslogtreecommitdiff
path: root/lib/resource.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-03-15 11:21:46 +0100
committerMaria Matejka <mq@ucw.cz>2022-03-15 11:21:46 +0100
commitc53f547a0bf437fb95923b2a0b9ac497e474aef1 (patch)
treec4fd70c83ef16b8d343c42a6f77616ee56e8bba2 /lib/resource.c
parent3c42f7af6a23de3f135235521318301e5b34f2de (diff)
Printf variant with a result allocated inside a pool / linpool
Diffstat (limited to 'lib/resource.c')
-rw-r--r--lib/resource.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/lib/resource.c b/lib/resource.c
index a179afe3..89e559b4 100644
--- a/lib/resource.c
+++ b/lib/resource.c
@@ -70,6 +70,20 @@ rp_new(pool *p, const char *name)
return z;
}
+pool *
+rp_newf(pool *p, const char *fmt, ...)
+{
+ pool *z = rp_new(p, NULL);
+
+ va_list args;
+ va_start(args, fmt);
+ z->name = mb_vsprintf(p, fmt, args);
+ va_end(args);
+
+ return z;
+}
+
+
static void
pool_free(resource *P)
{
@@ -410,21 +424,6 @@ mb_realloc(void *m, unsigned size)
return b->data;
}
-/**
- * mb_move - move a memory block
- * @m: memory block
- * @p: target pool
- *
- * mb_move() moves the given memory block to another pool in the same way
- * as rmove() moves a plain resource.
- */
-void
-mb_move(void *m, pool *p)
-{
- struct mblock *b = SKIP_BACK(struct mblock, data, m);
- rmove(b, p);
-}
-
/**
* mb_free - free a memory block