aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/vty/buffer.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@netfilter.org>2009-08-07 13:25:41 +0200
committerHarald Welte <laforge@netfilter.org>2009-08-07 13:25:41 +0200
commit0224e4d051ad7bd159ae82512bc554e90f4de99f (patch)
tree494abf11b26bb70b6911b3c0e7a91115d2b9bfb7 /openbsc/src/vty/buffer.c
parent2477d93c6e2fbda33e423f5514d591ea64da1685 (diff)
use one talloc context for entire vty code
Diffstat (limited to 'openbsc/src/vty/buffer.c')
-rw-r--r--openbsc/src/vty/buffer.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/openbsc/src/vty/buffer.c b/openbsc/src/vty/buffer.c
index be6623dac..8ab73114b 100644
--- a/openbsc/src/vty/buffer.c
+++ b/openbsc/src/vty/buffer.c
@@ -32,8 +32,6 @@
#include <vty/buffer.h>
#include <vty/vty.h>
-static void *tall_vbuf_ctx;
-
/* Buffer master. */
struct buffer {
/* Data list. */
@@ -71,7 +69,7 @@ struct buffer *buffer_new(size_t size)
{
struct buffer *b;
- b = talloc_zero(tall_vbuf_ctx, struct buffer);
+ b = talloc_zero(tall_vty_ctx, struct buffer);
if (size)
b->size = size;
@@ -105,7 +103,7 @@ char *buffer_getstr(struct buffer *b)
for (data = b->head; data; data = data->next)
totlen += data->cp - data->sp;
- if (!(s = _talloc_zero(tall_vbuf_ctx, (totlen + 1), "buffer_getstr")))
+ if (!(s = _talloc_zero(tall_vty_ctx, (totlen + 1), "buffer_getstr")))
return NULL;
p = s;
for (data = b->head; data; data = data->next) {
@@ -140,7 +138,7 @@ static struct buffer_data *buffer_add(struct buffer *b)
{
struct buffer_data *d;
- d = _talloc_zero(tall_vbuf_ctx,
+ d = _talloc_zero(tall_vty_ctx,
offsetof(struct buffer_data, data[b->size]),
"buffer_add");
if (!d)
@@ -463,8 +461,3 @@ buffer_write(struct buffer * b, int fd, const void *p, size_t size)
}
return b->head ? BUFFER_PENDING : BUFFER_EMPTY;
}
-
-static __attribute__((constructor)) void on_dso_load_vty_buf(void)
-{
- tall_vbuf_ctx = talloc_named_const(NULL, 1, "vty_buffer");
-}