diff options
author | 2015-05-02 14:29:32 +0000 | |
---|---|---|
committer | 2015-05-02 14:29:32 +0000 | |
commit | d37427b0b9a85ab33de663258d86eb13f59748b9 (patch) | |
tree | 498fa6bde82ce7cf4bb4e762420a4244386d37c5 | |
parent | Fix obvious problems with relayd config reload. (diff) | |
download | wireguard-openbsd-d37427b0b9a85ab33de663258d86eb13f59748b9.tar.xz wireguard-openbsd-d37427b0b9a85ab33de663258d86eb13f59748b9.zip |
Hoist common assignments out of a series of if/if-else statements
in get_token(). Simplifies code and shrinks future diff.
No intentional functional change.
-rw-r--r-- | sbin/dhclient/conflex.c | 12 | ||||
-rw-r--r-- | usr.sbin/dhcpd/conflex.c | 12 |
2 files changed, 6 insertions, 18 deletions
diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c index df77fb01ef6..f1e30909d32 100644 --- a/sbin/dhclient/conflex.c +++ b/sbin/dhclient/conflex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conflex.c,v 1.30 2015/05/02 12:37:35 krw Exp $ */ +/* $OpenBSD: conflex.c,v 1.31 2015/05/02 14:29:32 krw Exp $ */ /* Lexical scanner for dhclient config file. */ @@ -147,25 +147,19 @@ get_token(FILE *cfile) skip_to_eol(cfile); continue; } + lexline = l; + lexchar = p; if (c == '"') { - lexline = l; - lexchar = p; ttok = read_string(cfile); break; } if ((isascii(c) && isdigit(c)) || c == '-') { - lexline = l; - lexchar = p; ttok = read_number(c, cfile); break; } else if (isascii(c) && isalpha(c)) { - lexline = l; - lexchar = p; ttok = read_num_or_name(c, cfile); break; } else { - lexline = l; - lexchar = p; tb[0] = c; tb[1] = 0; tval = tb; diff --git a/usr.sbin/dhcpd/conflex.c b/usr.sbin/dhcpd/conflex.c index ef41ae8c67e..5f31921190b 100644 --- a/usr.sbin/dhcpd/conflex.c +++ b/usr.sbin/dhcpd/conflex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conflex.c,v 1.13 2015/05/02 12:37:35 krw Exp $ */ +/* $OpenBSD: conflex.c,v 1.14 2015/05/02 14:29:32 krw Exp $ */ /* Lexical scanner for dhcpd config file... */ @@ -131,25 +131,19 @@ get_token(FILE *cfile) skip_to_eol(cfile); continue; } + lexline = l; + lexchar = p; if (c == '"') { - lexline = l; - lexchar = p; ttok = read_string(cfile); break; } if ((isascii(c) && isdigit(c)) || c == '-') { - lexline = l; - lexchar = p; ttok = read_number(c, cfile); break; } else if (isascii(c) && isalpha(c)) { - lexline = l; - lexchar = p; ttok = read_num_or_name(c, cfile); break; } else { - lexline = l; - lexchar = p; tb[0] = c; tb[1] = 0; tval = tb; |