From 5476bdc6871cd231f6041ffed18201a40fd63370 Mon Sep 17 00:00:00 2001 From: joerg Date: Sat, 14 Dec 1996 19:53:49 +0000 Subject: Part #2 of the config cleanup. More aggressive, replaced an NIH version of strdup() by a macro, killed many calls to strdup(), thus potentially wasting less malloc'ed space (their args were never be free()ed desptie despite of being malloc'ed). Probably still a huge memory leak at all... Also killed two totally useless variables. I've tested it as i could, but wouldn't be surprised if unexpected problems showed up. So watch out this space! --- usr.sbin/config/mkoptions.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'usr.sbin/config/mkoptions.c') diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c index 40fe87e..aea47b6 100644 --- a/usr.sbin/config/mkoptions.c +++ b/usr.sbin/config/mkoptions.c @@ -41,10 +41,15 @@ static char sccsid[] = "@(#)mkheaders.c 8.1 (Berkeley) 6/6/93"; */ #include +#include #include #include "config.h" #include "y.tab.h" +#define ns(s) strdup(s) + +static char *lower __P((char *)); + options() { struct opt_list *ol; @@ -57,7 +62,7 @@ options() for (cp = cputype; cp; cp = cp->cpu_next) { struct opt *op = (struct opt *)malloc(sizeof (struct opt)); memset(op, 0, sizeof(*op)); - op->op_name = cp->cpu_name; + op->op_name = ns(cp->cpu_name); op->op_value = 0; op->op_next = opt; opt = op; @@ -226,7 +231,6 @@ read_options() struct opt_list *po; int first = 1; char genopt[80]; - char *lower(); otab = 0; (void) snprintf(fname, sizeof fname, "../../conf/options"); @@ -298,7 +302,7 @@ next: goto next; } -char * +static char * lower(str) register char *str; { -- cgit v1.1