diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-05-16 19:28:32 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-05-16 19:28:32 +0200 |
commit | 20474ad02983861cb6a9542916eaeb78a6615604 (patch) | |
tree | cb978440ff4e7c4506facf2235971eda33743dc6 /openbsc/src/vty_interface_cmds.c | |
parent | 08e2bfa920dacc04a3e45d0f34f85a1d8f06cb91 (diff) |
VTY: use argv_concat() instead of vty_argv_to_buffer + buffer_getstr()
Diffstat (limited to 'openbsc/src/vty_interface_cmds.c')
-rw-r--r-- | openbsc/src/vty_interface_cmds.c | 29 |
1 files changed, 2 insertions, 27 deletions
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; } |