From f6834d4c4031276361465dd19ef1918e239566c8 Mon Sep 17 00:00:00 2001 From: ajs Date: Fri, 28 Jan 2005 20:28:35 +0000 Subject: 2005-01-28 Andrew J. Schorr * lib/command.h: Document behavior of argv_concat function. * lib/command.c: (argv_concat) Calculate total string length first so we can call malloc just once (instead of realloc'ing to add each string element). (do_echo,config_logmsg) Allow for possible NULL return value from argv_concat. --- lib/command.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/command.h') diff --git a/lib/command.h b/lib/command.h index 8fdec98f..eba919cb 100644 --- a/lib/command.h +++ b/lib/command.h @@ -322,7 +322,11 @@ void install_default (enum node_type); void install_element (enum node_type, struct cmd_element *); void sort_node (); -char *argv_concat (const char **, int, int); +/* Concatenates argv[shift] through argv[argc-1] into a single NUL-terminated + string with a space between each element (allocated using + XMALLOC(MTYPE_TMP)). Returns NULL if shift >= argc. */ +char *argv_concat (const char **argv, int argc, int shift); + vector cmd_make_strvec (const char *); void cmd_free_strvec (vector); vector cmd_describe_command (); -- cgit v1.2.1