summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/misc.c b/misc.c
index ac616de02..c457a952c 100644
--- a/misc.c
+++ b/misc.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: misc.c,v 1.22 2003/09/18 08:49:45 markus Exp $"); 26RCSID("$OpenBSD: misc.c,v 1.21 2003/04/12 10:15:36 markus Exp $");
27 27
28#include "misc.h" 28#include "misc.h"
29#include "log.h" 29#include "log.h"
@@ -308,21 +308,18 @@ addargs(arglist *args, char *fmt, ...)
308{ 308{
309 va_list ap; 309 va_list ap;
310 char buf[1024]; 310 char buf[1024];
311 int nalloc;
312 311
313 va_start(ap, fmt); 312 va_start(ap, fmt);
314 vsnprintf(buf, sizeof(buf), fmt, ap); 313 vsnprintf(buf, sizeof(buf), fmt, ap);
315 va_end(ap); 314 va_end(ap);
316 315
317 nalloc = args->nalloc;
318 if (args->list == NULL) { 316 if (args->list == NULL) {
319 nalloc = 32; 317 args->nalloc = 32;
320 args->num = 0; 318 args->num = 0;
321 } else if (args->num+2 >= nalloc) 319 } else if (args->num+2 >= args->nalloc)
322 nalloc *= 2; 320 args->nalloc *= 2;
323 321
324 args->list = xrealloc(args->list, nalloc * sizeof(char *)); 322 args->list = xrealloc(args->list, args->nalloc * sizeof(char *));
325 args->nalloc = nalloc;
326 args->list[args->num++] = xstrdup(buf); 323 args->list[args->num++] = xstrdup(buf);
327 args->list[args->num] = NULL; 324 args->list[args->num] = NULL;
328} 325}