X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/c8773dc680d5ec95ad5f862d44ce15124c95146a..ca2f8cc7e93a21f9f04e0d976ca97feac4802e91:/sbr/arglist.c diff --git a/sbr/arglist.c b/sbr/arglist.c index 68a26a20..9425439a 100644 --- a/sbr/arglist.c +++ b/sbr/arglist.c @@ -1,6 +1,4 @@ - -/* - * arglist.c -- Routines for handling argument lists for execvp() and friends +/* arglist.c -- Routines for handling argument lists for execvp() and friends * * This code is Copyright (c) 2013, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for @@ -52,7 +50,7 @@ argsplit(char *command, char **file, int *argp) } } - argvarray = (char **) mh_xmalloc((sizeof(char **) * (MAXARGS + 5))); + argvarray = mh_xmalloc(sizeof *argvarray * (MAXARGS + 5)); /* * The simple case - no spaces or shell metacharacters @@ -133,8 +131,7 @@ arglist_free(char *command, char **argvarray) { int i; - if (command != NULL) - free(command); + free(command); if (argvarray != NULL) { for (i = 0; argvarray[i] != NULL; i++) @@ -202,8 +199,8 @@ argsplit_insert(struct msgs_array *msgs, char *command, char **program) */ if (msgs->size + argp >= msgs->max) { - msgs->max += MAXMSGS > argp ? MAXMSGS : argp; - msgs->msgs = mh_xrealloc(msgs->msgs, msgs->max * sizeof(*msgs->msgs)); + msgs->max += max(MAXMSGS, argp); + msgs->msgs = mh_xrealloc(msgs->msgs, msgs->max * sizeof(*msgs->msgs)); } for (i = msgs->size - 1; i >= 0; i--)