diff options
author | joerg <joerg@FreeBSD.org> | 1996-12-14 19:53:49 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1996-12-14 19:53:49 +0000 |
commit | 5476bdc6871cd231f6041ffed18201a40fd63370 (patch) | |
tree | 5f4ce179ffc745f34801c743beca866f4dff0bf6 /usr.sbin/config/mkoptions.c | |
parent | 000a733206a490453542c9e437941673ec57912a (diff) | |
download | FreeBSD-src-5476bdc6871cd231f6041ffed18201a40fd63370.zip FreeBSD-src-5476bdc6871cd231f6041ffed18201a40fd63370.tar.gz |
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!
Diffstat (limited to 'usr.sbin/config/mkoptions.c')
-rw-r--r-- | usr.sbin/config/mkoptions.c | 10 |
1 files changed, 7 insertions, 3 deletions
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 <stdio.h> +#include <string.h> #include <ctype.h> #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; { |