diff options
author | peter <peter@FreeBSD.org> | 2001-02-22 04:00:29 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2001-02-22 04:00:29 +0000 |
commit | 5d555e0a45b58e15cf12e405ca3118ded5317d88 (patch) | |
tree | da03dbabd59ef3bdcdc9fc8fcfcdfdd5c9bf7a6f /usr.sbin/config | |
parent | 6af82228b4ff0156897b6c7036e21107615a8cef (diff) | |
download | FreeBSD-src-5d555e0a45b58e15cf12e405ca3118ded5317d88.zip FreeBSD-src-5d555e0a45b58e15cf12e405ca3118ded5317d88.tar.gz |
Futher cleanups. Since we have two options lists, one for proper options
and one for Makefile options, pass in the list head and use a common
newopt() routine.
Fix the 'config vmunix' support glue which was broken for a few minutes.
Diffstat (limited to 'usr.sbin/config')
-rw-r--r-- | usr.sbin/config/config.y | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y index 5ddfb9b..96e57d9 100644 --- a/usr.sbin/config/config.y +++ b/usr.sbin/config/config.y @@ -158,9 +158,7 @@ System_spec: System_id: Save_id - = { - newopt(ns("KERNEL"), $1); - }; + = { newopt(&mkopt, ns("KERNEL"), $1); }; System_parameter_list: System_parameter_list ID @@ -178,13 +176,13 @@ Option: = { char *s; - newopt($1, NULL); + newopt(&opt, $1, NULL); if ((s = strchr($1, '='))) errx(1, "line %d: The `=' in options should not be quoted", yyline); } | Save_id EQUALS Opt_value = { - newopt($1, $3); + newopt(&opt, $1, $3); } ; Opt_value: @@ -211,14 +209,7 @@ Mkopt_list: Mkoption: Save_id EQUALS Opt_value - = { - struct opt *op = (struct opt *)malloc(sizeof (struct opt)); - memset(op, 0, sizeof(*op)); - op->op_name = $1; - op->op_value = $3; - op->op_next = mkopt; - mkopt = op; - } ; + = { newopt(&mkopt, $1, $3); } ; Dev: ID @@ -228,13 +219,13 @@ Dev: Device_spec: DEVICE Dev = { - newopt(devopt($2), ns("1")); + newopt(&opt, devopt($2), ns("1")); /* and the device part */ newdev($2, UNKNOWN); } | DEVICE Dev NUMBER = { - newopt(devopt($2), ns("1")); + newopt(&opt, devopt($2), ns("1")); /* and the device part */ newdev($2, $3); if ($3 == 0) @@ -271,7 +262,7 @@ newdev(char *name, int count) } static void -newopt(char *name, char *value) +newopt(struct opt **list, char *name, char *value) { struct opt *op; @@ -280,6 +271,6 @@ newopt(char *name, char *value) op->op_name = name; op->op_ownfile = 0; op->op_value = value; - op->op_next = opt; - opt = op; + op->op_next = *list; + *list = op; } |