diff options
Diffstat (limited to 'strlist.c')
-rw-r--r-- | strlist.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/strlist.c b/strlist.c index 3fb2f7dbb6c8..905e78fd8caa 100644 --- a/strlist.c +++ b/strlist.c @@ -1,4 +1,4 @@ -/* $NetBSD: strlist.c,v 1.4 2009/01/24 11:59:39 dsl Exp $ */ +/* $NetBSD: strlist.c,v 1.6 2020/08/25 17:37:09 rillig Exp $ */ /*- * Copyright (c) 2008 - 2009 The NetBSD Foundation, Inc. @@ -33,18 +33,16 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: strlist.c,v 1.4 2009/01/24 11:59:39 dsl Exp $"; +static char rcsid[] = "$NetBSD: strlist.c,v 1.6 2020/08/25 17:37:09 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: strlist.c,v 1.4 2009/01/24 11:59:39 dsl Exp $"); +__RCSID("$NetBSD: strlist.c,v 1.6 2020/08/25 17:37:09 rillig Exp $"); #endif /* not lint */ #endif -#include <stddef.h> -#include <stdlib.h> +#include "make.h" #include "strlist.h" -#include "make_malloc.h" void strlist_init(strlist_t *sl) @@ -76,18 +74,18 @@ strlist_add_str(strlist_t *sl, char *str, unsigned int info) strlist_item_t *items; if (str == NULL) - return; + return; n = sl->sl_num + 1; sl->sl_num = n; items = sl->sl_items; if (n >= sl->sl_max) { - items = bmake_realloc(items, (n + 7) * sizeof *sl->sl_items); - sl->sl_items = items; - sl->sl_max = n + 6; + items = bmake_realloc(items, (n + 7) * sizeof *sl->sl_items); + sl->sl_items = items; + sl->sl_max = n + 6; } items += n - 1; items->si_str = str; items->si_info = info; - items[1].si_str = NULL; /* STRLIST_FOREACH() terminator */ + items[1].si_str = NULL; /* STRLIST_FOREACH() terminator */ } |