diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2000-06-17 14:43:41 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2000-06-17 14:43:41 +0000 |
commit | d0f862960eef69fdd7801239999a637a2b2d5021 (patch) | |
tree | d044a096bd0bd61354904e3f2933b6e6e9260f0c /usr.bin/make/lst.lib/lstLast.c | |
parent | ba25a00b79070aa39d76e92f0c729f0e2a3f39a4 (diff) |
This removes the few instances of Lst_New left.
- replaces Lst_Duplicate with Lst_Clone, which does not allocate storage
- split Lst_Concat into Lst_Concat/Lst_ConcatDestroy
Thus, all the LstValid checks are gone, since we always invoke list
functions with valid pointers.
Note that dynamic list allocation accounted for roughly 20% of all calls
to malloc. The extraneous calls to malloc left are now mostly in parse.c,
which makes some wasteful usage of temporary buffers.
With those few patches, the code is sturdier, and easier to maintain.
Reviewed by millert@
Diffstat (limited to 'usr.bin/make/lst.lib/lstLast.c')
-rw-r--r-- | usr.bin/make/lst.lib/lstLast.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/usr.bin/make/lst.lib/lstLast.c b/usr.bin/make/lst.lib/lstLast.c index 65a3128821e..3117ce856cc 100644 --- a/usr.bin/make/lst.lib/lstLast.c +++ b/usr.bin/make/lst.lib/lstLast.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lstLast.c,v 1.6 2000/06/17 14:34:09 espie Exp $ */ +/* $OpenBSD: lstLast.c,v 1.7 2000/06/17 14:43:40 espie Exp $ */ /* $NetBSD: lstLast.c,v 1.5 1996/11/06 17:59:48 christos Exp $ */ /* @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)lstLast.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: lstLast.c,v 1.6 2000/06/17 14:34:09 espie Exp $"; +static char rcsid[] = "$OpenBSD: lstLast.c,v 1.7 2000/06/17 14:43:40 espie Exp $"; #endif #endif /* not lint */ @@ -65,9 +65,6 @@ LstNode Lst_Last(l) Lst l; { - if (!LstValid(l) || LstIsEmpty(l)) - return NULL; - else - return (LstNode)(l->lastPtr); + return l->lastPtr; } |