From 20474ad02983861cb6a9542916eaeb78a6615604 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 16 May 2010 19:28:32 +0200 Subject: VTY: use argv_concat() instead of vty_argv_to_buffer + buffer_getstr() --- openbsc/src/vty_interface_cmds.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'openbsc/src/vty_interface_cmds.c') diff --git a/openbsc/src/vty_interface_cmds.c b/openbsc/src/vty_interface_cmds.c index 9ca9a247f..06eb2a56a 100644 --- a/openbsc/src/vty_interface_cmds.c +++ b/openbsc/src/vty_interface_cmds.c @@ -39,23 +39,6 @@ static void _vty_output(struct log_target *tgt, const char *line) vty_out(vty, "\r"); } -struct buffer *vty_argv_to_buffer(int argc, const char *argv[], int base) -{ - struct buffer *b = buffer_new(NULL, 1024); - int i; - - if (!b) - return NULL; - - for (i = base; i < argc; i++) { - buffer_putstr(b, argv[i]); - buffer_putc(b, ' '); - } - buffer_putc(b, '\0'); - - return b; -} - struct log_target *log_target_create_vty(struct vty *vty) { struct log_target *target; @@ -410,24 +393,16 @@ gDEFUN(cfg_description, cfg_description_cmd, "Save human-readable decription of the object\n") { char **dptr = vty->index_sub; - struct buffer *b; if (!dptr) { vty_out(vty, "vty->index_sub == NULL%s", VTY_NEWLINE); return CMD_WARNING; } - b = vty_argv_to_buffer(argc, argv, 0); - if (!b) + *dptr = argv_concat(argv, argc, 0); + if (!dptr) return CMD_WARNING; - if (*dptr) - talloc_free(*dptr); - - *dptr = talloc_strdup(NULL, buffer_getstr(b)); - - buffer_free(b); - return CMD_SUCCESS; } -- cgit v1.2.3