summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd/parse.y
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-14 06:29:55 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-14 06:29:55 +0000
commita5de5fdd18fee1070631794d771d0d569fddb177 (patch)
treee60e9f08e1a2e3bd5f883f85d2b550578830ba49 /usr.sbin/ntpd/parse.y
parentfb78bb796c5896edebe555767c843543497c4e26 (diff)
use a setup function for options, cleaner; ok cloder
Diffstat (limited to 'usr.sbin/ntpd/parse.y')
-rw-r--r--usr.sbin/ntpd/parse.y18
1 files changed, 13 insertions, 5 deletions
diff --git a/usr.sbin/ntpd/parse.y b/usr.sbin/ntpd/parse.y
index 83d998e6528..02be8030b9d 100644
--- a/usr.sbin/ntpd/parse.y
+++ b/usr.sbin/ntpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.34 2007/09/14 03:07:11 ckuethe Exp $ */
+/* $OpenBSD: parse.y,v 1.35 2007/09/14 06:29:54 deraadt Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -55,6 +55,7 @@ struct opts {
int weight;
int correction;
} opts;
+void opts_default(void);
typedef struct {
union {
@@ -216,10 +217,10 @@ address : STRING {
}
;
-server_opts : { bzero(&opts, sizeof opts); opts.weight = 1; }
+server_opts : { opts_default(); }
server_opts_l
{ $$ = opts; }
- | { bzero(&opts, sizeof opts); opts.weight = 1; $$ = opts; }
+ | { opts_default(); $$ = opts; }
;
server_opts_l : server_opts_l server_opt
| server_opt
@@ -227,10 +228,10 @@ server_opts_l : server_opts_l server_opt
server_opt : weight
;
-sensor_opts : { bzero(&opts, sizeof opts); opts.weight = 1; }
+sensor_opts : { opts_default(); }
sensor_opts_l
{ $$ = opts; }
- | { bzero(&opts, sizeof opts); opts.weight = 1; $$ = opts; }
+ | { opts_default(); $$ = opts; }
;
sensor_opts_l : sensor_opts_l sensor_opt
| sensor_opt
@@ -260,6 +261,13 @@ weight : WEIGHT NUMBER {
%%
+void
+opts_default(void)
+{
+ bzero(&opts, sizeof opts);
+ opts.weight = 1;
+}
+
struct keywords {
const char *k_name;
int k_val;