make(1): remove unused strlist_t
This commit is contained in:
parent
2300fe1ad0
commit
f1132483d6
@ -1,4 +1,4 @@
|
|||||||
# $NetBSD: Makefile,v 1.105 2020/10/23 15:44:38 rillig Exp $
|
# $NetBSD: Makefile,v 1.106 2020/10/25 13:25:19 rillig Exp $
|
||||||
# @(#)Makefile 5.2 (Berkeley) 12/28/90
|
# @(#)Makefile 5.2 (Berkeley) 12/28/90
|
||||||
|
|
||||||
PROG= make
|
PROG= make
|
||||||
@ -18,7 +18,6 @@ SRCS+= make_malloc.c
|
|||||||
SRCS+= metachar.c
|
SRCS+= metachar.c
|
||||||
SRCS+= parse.c
|
SRCS+= parse.c
|
||||||
SRCS+= str.c
|
SRCS+= str.c
|
||||||
SRCS+= strlist.c
|
|
||||||
SRCS+= suff.c
|
SRCS+= suff.c
|
||||||
SRCS+= targ.c
|
SRCS+= targ.c
|
||||||
SRCS+= trace.c
|
SRCS+= trace.c
|
||||||
@ -37,7 +36,6 @@ HDRS+= meta.h
|
|||||||
HDRS+= metachar.h
|
HDRS+= metachar.h
|
||||||
HDRS+= nonints.h
|
HDRS+= nonints.h
|
||||||
HDRS+= pathnames.h
|
HDRS+= pathnames.h
|
||||||
HDRS+= strlist.h
|
|
||||||
HDRS+= trace.h
|
HDRS+= trace.h
|
||||||
|
|
||||||
# Whether to generate a coverage report after running the tests.
|
# Whether to generate a coverage report after running the tests.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# $NetBSD: Makefile.boot,v 1.22 2020/08/09 15:54:13 rillig Exp $
|
# $NetBSD: Makefile.boot,v 1.23 2020/10/25 13:25:19 rillig Exp $
|
||||||
#
|
#
|
||||||
# A very simple makefile...
|
# A very simple makefile...
|
||||||
#
|
#
|
||||||
@ -18,7 +18,7 @@ EXTRA_LIBS=
|
|||||||
|
|
||||||
OBJS= arch.o buf.o compat.o cond.o dir.o enum.o for.o hash.o \
|
OBJS= arch.o buf.o compat.o cond.o dir.o enum.o for.o hash.o \
|
||||||
job.o lst.o main.o make.o make_malloc.o metachar.o parse.o \
|
job.o lst.o main.o make.o make_malloc.o metachar.o parse.o \
|
||||||
str.o strlist.o suff.o targ.o trace.o var.o util.o
|
str.o suff.o targ.o trace.o var.o util.o
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
${CC} ${CPPFLAGS} ${CFLAGS} ${EXTRA_CFLAGS} -c $< -o $@
|
${CC} ${CPPFLAGS} ${CFLAGS} ${EXTRA_CFLAGS} -c $< -o $@
|
||||||
|
@ -1,84 +0,0 @@
|
|||||||
/* $NetBSD: strlist.c,v 1.8 2020/09/13 15:15:51 rillig Exp $ */
|
|
||||||
|
|
||||||
/*-
|
|
||||||
* Copyright (c) 2008 - 2009 The NetBSD Foundation, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This code is derived from software contributed to The NetBSD Foundation
|
|
||||||
* by David Laight.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of The NetBSD Foundation nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived
|
|
||||||
* from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
||||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
||||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "make.h"
|
|
||||||
#include "strlist.h"
|
|
||||||
|
|
||||||
MAKE_RCSID("$NetBSD: strlist.c,v 1.8 2020/09/13 15:15:51 rillig Exp $");
|
|
||||||
|
|
||||||
void
|
|
||||||
strlist_init(strlist_t *sl)
|
|
||||||
{
|
|
||||||
sl->sl_num = 0;
|
|
||||||
sl->sl_max = 0;
|
|
||||||
sl->sl_items = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
strlist_clean(strlist_t *sl)
|
|
||||||
{
|
|
||||||
char *str;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
STRLIST_FOREACH(str, sl, i)
|
|
||||||
free(str);
|
|
||||||
free(sl->sl_items);
|
|
||||||
|
|
||||||
sl->sl_num = 0;
|
|
||||||
sl->sl_max = 0;
|
|
||||||
sl->sl_items = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
strlist_add_str(strlist_t *sl, char *str, unsigned int info)
|
|
||||||
{
|
|
||||||
unsigned int n;
|
|
||||||
strlist_item_t *items;
|
|
||||||
|
|
||||||
if (str == NULL)
|
|
||||||
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 *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 */
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
/* $NetBSD: strlist.h,v 1.4 2020/08/13 03:54:57 rillig Exp $ */
|
|
||||||
|
|
||||||
/*-
|
|
||||||
* Copyright (c) 2008 - 2009 The NetBSD Foundation, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This code is derived from software contributed to The NetBSD Foundation
|
|
||||||
* by David Laight.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of The NetBSD Foundation nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived
|
|
||||||
* from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
||||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
||||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MAKE_STRLIST_H
|
|
||||||
#define MAKE_STRLIST_H
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char *si_str;
|
|
||||||
unsigned int si_info;
|
|
||||||
} strlist_item_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned int sl_num;
|
|
||||||
unsigned int sl_max;
|
|
||||||
strlist_item_t *sl_items;
|
|
||||||
} strlist_t;
|
|
||||||
|
|
||||||
void strlist_init(strlist_t *);
|
|
||||||
void strlist_clean(strlist_t *);
|
|
||||||
void strlist_add_str(strlist_t *, char *, unsigned int);
|
|
||||||
|
|
||||||
#define strlist_num(sl) ((sl)->sl_num)
|
|
||||||
#define strlist_str(sl, n) ((sl)->sl_items[n].si_str)
|
|
||||||
#define strlist_info(sl, n) ((sl)->sl_items[n].si_info)
|
|
||||||
#define strlist_set_info(sl, n, v) ((void)((sl)->sl_items[n].si_info = (v)))
|
|
||||||
|
|
||||||
#define STRLIST_FOREACH(v, sl, index) \
|
|
||||||
if ((sl)->sl_items != NULL) \
|
|
||||||
for (index = 0; (v = strlist_str(sl, index)) != NULL; index++)
|
|
||||||
|
|
||||||
#endif /* MAKE_STRLIST_H */
|
|
Loading…
Reference in New Issue
Block a user