From 0f7a8258f041454b7b15ee434940a2028f5c3a82 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 30 Apr 2010 12:18:32 +0800 Subject: [vty] Move some allocations into the context of the vty. --- openbsc/src/vty/vty.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openbsc/src/vty/vty.c b/openbsc/src/vty/vty.c index 66e7d05d8..8455b0e3d 100644 --- a/openbsc/src/vty/vty.c +++ b/openbsc/src/vty/vty.c @@ -54,7 +54,7 @@ struct vty *vty_new() new->obuf = buffer_new(0); /* Use default buffer size. */ if (!new->obuf) goto out_new; - new->buf = _talloc_zero(tall_vty_ctx, VTY_BUFSIZ, "vty_new->buf"); + new->buf = _talloc_zero(new, VTY_BUFSIZ, "vty_new->buf"); if (!new->buf) goto out_obuf; @@ -210,7 +210,7 @@ int vty_out(struct vty *vty, const char *format, ...) else size = size * 2; - p = talloc_realloc_size(tall_vty_ctx, p, size); + p = talloc_realloc_size(vty, p, size); if (!p) return -1; @@ -357,7 +357,7 @@ static void vty_ensure(struct vty *vty, int length) { if (vty->max <= length) { vty->max *= 2; - vty->buf = talloc_realloc_size(tall_vty_ctx, vty->buf, vty->max); + vty->buf = talloc_realloc_size(vty, vty->buf, vty->max); // FIXME: check return } } @@ -458,7 +458,7 @@ static void vty_hist_add(struct vty *vty) /* Insert history entry. */ if (vty->hist[vty->hindex]) talloc_free(vty->hist[vty->hindex]); - vty->hist[vty->hindex] = talloc_strdup(tall_vty_ctx, vty->buf); + vty->hist[vty->hindex] = talloc_strdup(vty, vty->buf); /* History index rotation. */ vty->hindex++; @@ -965,7 +965,7 @@ vty_describe_fold(struct vty *vty, int cmd_width, return; } - buf = _talloc_zero(tall_vty_ctx, strlen(desc->str) + 1, "describe_fold"); + buf = _talloc_zero(vty, strlen(desc->str) + 1, "describe_fold"); if (!buf) return; -- cgit v1.2.3