From: krw Date: Mon, 10 Jul 2017 00:47:47 +0000 (+0000) Subject: Use a modern spacious idiom on all function local variable X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5d0bc9708922b1546ae43d4efdd6b913facbb34a;p=openbsd Use a modern spacious idiom on all function local variable declarations. --- diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c index 21e6ba981ec..1f701e55123 100644 --- a/sbin/dhclient/bpf.c +++ b/sbin/dhclient/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.58 2017/07/09 19:19:58 krw Exp $ */ +/* $OpenBSD: bpf.c,v 1.59 2017/07/10 00:47:47 krw Exp $ */ /* BPF socket interface code, originally contributed by Archie Cobbs. */ @@ -75,8 +75,8 @@ void if_register_bpf(struct interface_info *ifi); void if_register_bpf(struct interface_info *ifi) { - struct ifreq ifr; - int sock; + struct ifreq ifr; + int sock; if ((sock = open("/dev/bpf", O_RDWR | O_CLOEXEC)) == -1) fatal("Can't open bpf"); @@ -92,7 +92,7 @@ if_register_bpf(struct interface_info *ifi) void if_register_send(struct interface_info *ifi) { - int sock, on = 1; + int sock, on = 1; /* * Use raw socket for unicast send. @@ -187,9 +187,9 @@ int dhcp_bpf_wfilter_len = sizeof(dhcp_bpf_wfilter) / sizeof(struct bpf_insn); void if_register_receive(struct interface_info *ifi) { - struct bpf_version v; - struct bpf_program p; - int flag = 1, sz; + struct bpf_version v; + struct bpf_program p; + int flag = 1, sz; /* Open a BPF device and hang it on this interface. */ if_register_bpf(ifi); @@ -256,15 +256,15 @@ if_register_receive(struct interface_info *ifi) ssize_t send_packet(struct interface_info *ifi, struct in_addr from, struct in_addr to) { - struct sockaddr_in dest; - struct ether_header eh; - struct ip ip; - struct udphdr udp; - struct iovec iov[4]; - struct msghdr msg; - struct dhcp_packet *packet = &ifi->sent_packet; - ssize_t result; - int iovcnt = 0, len = ifi->sent_packet_length; + struct iovec iov[4]; + struct sockaddr_in dest; + struct ether_header eh; + struct ip ip; + struct udphdr udp; + struct msghdr msg; + struct dhcp_packet *packet = &ifi->sent_packet; + ssize_t result; + int iovcnt = 0, len = ifi->sent_packet_length; memset(&dest, 0, sizeof(dest)); dest.sin_family = AF_INET; @@ -331,9 +331,9 @@ ssize_t receive_packet(struct interface_info *ifi, struct sockaddr_in *from, struct ether_addr *hfrom) { - struct dhcp_packet *packet = &ifi->recv_packet; - int length = 0, offset = 0; - struct bpf_hdr hdr; + struct bpf_hdr hdr; + struct dhcp_packet *packet = &ifi->recv_packet; + int length = 0, offset = 0; /* * All this complexity is because BPF doesn't guarantee that diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index 3a6c281a90b..dfd864e80f6 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clparse.c,v 1.121 2017/07/09 21:29:19 krw Exp $ */ +/* $OpenBSD: clparse.c,v 1.122 2017/07/10 00:47:47 krw Exp $ */ /* Parser for dhclient config and lease files. */ @@ -541,9 +541,9 @@ void parse_client_lease_declaration(FILE *cfile, struct client_lease *lease, char *name) { - char *val; - unsigned int len; - int token; + char *val; + unsigned int len; + int token; token = next_token(&val, cfile); @@ -769,9 +769,9 @@ parse_option_decl(FILE *cfile, struct option_data *options) void parse_reject_statement(FILE *cfile) { - struct reject_elem *elem; - struct in_addr addr; - int token; + struct in_addr addr; + struct reject_elem *elem; + int token; do { if (!parse_ip_addr(cfile, &addr)) diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c index a9d0dcdcdd6..df5f177fbc3 100644 --- a/sbin/dhclient/conflex.c +++ b/sbin/dhclient/conflex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conflex.c,v 1.41 2017/07/09 19:19:58 krw Exp $ */ +/* $OpenBSD: conflex.c,v 1.42 2017/07/10 00:47:47 krw Exp $ */ /* Lexical scanner for dhclient config file. */ @@ -140,8 +140,8 @@ get_char(FILE *cfile) static int get_token(FILE *cfile) { - int c, ttok; static char tb[2]; + int c, ttok; int l, p, u; u = ugflag; @@ -203,7 +203,7 @@ next_token(char **rval, FILE *cfile) int peek_token(char **rval, FILE *cfile) { - int x; + int x; if (!token) { tlpos = lexchar; @@ -227,7 +227,7 @@ peek_token(char **rval, FILE *cfile) static void skip_to_eol(FILE *cfile) { - int c; + int c; do { c = get_char(cfile); @@ -241,7 +241,7 @@ skip_to_eol(FILE *cfile) static int read_string(FILE *cfile) { - int i, c, bs; + int i, c, bs; /* * Read in characters until an un-escaped '"' is encountered. @@ -277,8 +277,8 @@ read_string(FILE *cfile) static int read_num_or_name(int c, FILE *cfile) { - unsigned int i, xdigits; - int rv; + unsigned int i, xdigits; + int rv; xdigits = isxdigit(c) ? 1 : 0; @@ -319,7 +319,7 @@ read_num_or_name(int c, FILE *cfile) static const struct keywords { const char *k_name; - int k_val; + int k_val; } keywords[] = { { "append", TOK_APPEND }, { "backoff-cutoff", TOK_BACKOFF_CUTOFF }, @@ -363,7 +363,7 @@ kw_cmp(const void *k, const void *e) static int intern(char *atom, int dfv) { - const struct keywords *p; + const struct keywords *p; p = bsearch(atom, keywords, sizeof(keywords)/sizeof(keywords[0]), sizeof(keywords[0]), kw_cmp); diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 48e5e44f464..be5559caac2 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.463 2017/07/09 19:19:58 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.464 2017/07/10 00:47:47 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -175,8 +175,8 @@ sighdlr(int sig) int findproto(char *cp, int n) { - struct sockaddr *sa; - unsigned int i; + struct sockaddr *sa; + unsigned int i; if (n == 0) return -1; @@ -205,8 +205,8 @@ findproto(char *cp, int n) struct sockaddr * get_ifa(char *cp, int n) { - struct sockaddr *sa; - unsigned int i; + struct sockaddr *sa; + unsigned int i; if (n == 0) return NULL; @@ -698,9 +698,9 @@ usage(void) void state_preboot(struct interface_info *ifi) { - static int preamble; - time_t cur_time; - int interval; + static int preamble; + time_t cur_time; + int interval; time(&cur_time); @@ -792,7 +792,7 @@ state_init(struct interface_info *ifi) void state_selecting(struct interface_info *ifi) { - struct option_data *option; + struct option_data *option; cancel_timeout(ifi); @@ -860,8 +860,8 @@ state_selecting(struct interface_info *ifi) void dhcpoffer(struct interface_info *ifi, struct option_data *options, char *info) { - struct client_lease *lease; - time_t stop_selecting; + struct client_lease *lease; + time_t stop_selecting; if (ifi->state != S_SELECTING) { #ifdef DEBUG @@ -899,7 +899,7 @@ dhcpoffer(struct interface_info *ifi, struct option_data *options, char *info) void dhcpack(struct interface_info *ifi, struct option_data *options, char *info) { - struct client_lease *lease; + struct client_lease *lease; if (ifi->state != S_REBOOTING && ifi->state != S_REQUESTING && @@ -970,12 +970,12 @@ dhcpnak(struct interface_info *ifi, struct option_data *options, char *info) void bind_lease(struct interface_info *ifi) { - struct in_addr gateway, mask; - struct option_data *opt; - struct option_data *options; - struct client_lease *lease, *pl; - time_t cur_time; - int seen; + struct in_addr gateway, mask; + struct option_data *opt; + struct option_data *options; + struct client_lease *lease, *pl; + time_t cur_time; + int seen; /* * Clear out any old resolv_conf in case the lease has been here @@ -1123,8 +1123,8 @@ newlease: void state_bound(struct interface_info *ifi) { - struct option_data *opt; - struct in_addr *dest; + struct option_data *opt; + struct in_addr *dest; ifi->xid = arc4random(); make_request(ifi, ifi->active); @@ -1147,9 +1147,9 @@ state_bound(struct interface_info *ifi) int addressinuse(char *name, struct in_addr address, char *ifname) { - struct ifaddrs *ifap, *ifa; - struct sockaddr_in *sin; - int used = 0; + struct ifaddrs *ifap, *ifa; + struct sockaddr_in *sin; + int used = 0; if (getifaddrs(&ifap) != 0) { log_warn("addressinuse: getifaddrs"); @@ -1184,11 +1184,11 @@ addressinuse(char *name, struct in_addr address, char *ifname) struct client_lease * packet_to_lease(struct interface_info *ifi, struct option_data *options) { - struct dhcp_packet *packet = &ifi->recv_packet; - char ifname[IF_NAMESIZE]; - struct client_lease *lease; - char *pretty, *buf, *name; - int i; + char ifname[IF_NAMESIZE]; + struct dhcp_packet *packet = &ifi->recv_packet; + struct client_lease *lease; + char *pretty, *buf, *name; + int i; lease = calloc(1, sizeof(struct client_lease)); if (lease == NULL) { @@ -1323,10 +1323,10 @@ decline: void send_discover(struct interface_info *ifi) { - struct dhcp_packet *packet = &ifi->sent_packet; - time_t cur_time; - ssize_t rslt; - int interval; + struct dhcp_packet *packet = &ifi->sent_packet; + time_t cur_time; + ssize_t rslt; + int interval; time(&cur_time); @@ -1408,11 +1408,11 @@ state_panic(struct interface_info *ifi) void send_request(struct interface_info *ifi) { - struct dhcp_packet *packet = &ifi->sent_packet; - struct sockaddr_in destination; - struct in_addr from; - time_t cur_time; - int interval; + struct sockaddr_in destination; + struct in_addr from; + struct dhcp_packet *packet = &ifi->sent_packet; + time_t cur_time; + int interval; time(&cur_time); @@ -1739,7 +1739,7 @@ make_decline(struct interface_info *ifi, struct client_lease *lease) void free_client_lease(struct client_lease *lease) { - int i; + int i; /* Static leases are forever. */ if (lease == NULL || lease->is_static) @@ -1757,9 +1757,9 @@ free_client_lease(struct client_lease *lease) void rewrite_client_leases(struct interface_info *ifi) { - struct client_lease *lp; - char *leasestr; - time_t cur_time; + struct client_lease *lp; + char *leasestr; + time_t cur_time; if (!leaseFile) /* XXX */ fatalx("lease file not open"); @@ -1797,7 +1797,7 @@ void rewrite_option_db(char *name, struct client_lease *offered, struct client_lease *effective) { - char *leasestr; + char *leasestr; if (!optionDB) return; @@ -1832,12 +1832,12 @@ append_statement(char *string, size_t sz, char *s1, char *s2) char * lease_as_string(char *ifname, char *type, struct client_lease *lease) { - static char string[8192]; - char timebuf[27]; /* to hold "6 2017/04/08 05:47:50 UTC;" */ - struct option_data *opt; - char *buf, *name; - size_t rslt; - int i; + static char string[8192]; + char timebuf[27]; /* 6 2017/04/08 05:47:50 UTC; */ + struct option_data *opt; + char *buf, *name; + size_t rslt; + int i; memset(string, 0, sizeof(string)); @@ -1919,7 +1919,7 @@ lease_as_string(char *ifname, char *type, struct client_lease *lease) void go_daemon(void) { - static int state = 0; + static int state = 0; if (!daemonize || state) return; @@ -1972,9 +1972,9 @@ rdaemon(int devnull) int res_hnok(const char *name) { - const char *dn = name; - int pch = '.', ch = (unsigned char)*dn++; - int warn = 0; + const char *dn = name; + int pch = '.', ch = (unsigned char)*dn++; + int warn = 0; while (ch != '\0') { int nch = (unsigned char)*dn++; @@ -2004,8 +2004,8 @@ res_hnok(const char *name) int res_hnok_list(const char *names) { - char *dupnames, *hn, *inputstring; - int count; + char *dupnames, *hn, *inputstring; + int count; if (strlen(names) >= DHCP_DOMAIN_SEARCH_LEN) return 0; @@ -2121,10 +2121,10 @@ fork_privchld(struct interface_info *ifi, int fd, int fd2) void get_ifname(struct interface_info *ifi, char *arg) { - struct ifgroupreq ifgr; - struct ifg_req *ifg; - unsigned int len; - int s; + struct ifgroupreq ifgr; + struct ifg_req *ifg; + unsigned int len; + int s; if (strcmp(arg, "egress") == 0) { s = socket(AF_INET, SOCK_DGRAM, 0); @@ -2164,8 +2164,8 @@ get_ifname(struct interface_info *ifi, char *arg) struct client_lease * apply_defaults(struct client_lease *lease) { - struct client_lease *newlease; - int i, j; + struct client_lease *newlease; + int i, j; newlease = clone_lease(lease); if (newlease == NULL) @@ -2294,8 +2294,8 @@ cleanup: struct client_lease * clone_lease(struct client_lease *oldlease) { - struct client_lease *newlease; - int i; + struct client_lease *newlease; + int i; newlease = calloc(1, sizeof(struct client_lease)); if (newlease == NULL) @@ -2357,9 +2357,9 @@ cleanup: void apply_ignore_list(char *ignore_list) { - uint8_t list[DHO_COUNT]; - char *p; - int ix, i, j; + uint8_t list[DHO_COUNT]; + char *p; + int ix, i, j; memset(list, 0, sizeof(list)); ix = 0; @@ -2452,7 +2452,7 @@ set_lease_times(struct client_lease *lease) int compare_lease(struct client_lease *active, struct client_lease *new) { - int i; + int i; if (active == new) return 0; @@ -2584,7 +2584,7 @@ get_recorded_lease(struct interface_info *ifi) void set_default_client_identifier(struct interface_info *ifi) { - struct option_data *opt; + struct option_data *opt; /* * diff --git a/sbin/dhclient/kroute.c b/sbin/dhclient/kroute.c index 003e2db5f91..b065e98235b 100644 --- a/sbin/dhclient/kroute.c +++ b/sbin/dhclient/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.105 2017/07/09 19:19:58 krw Exp $ */ +/* $OpenBSD: kroute.c,v 1.106 2017/07/10 00:47:47 krw Exp $ */ /* * Copyright 2012 Kenneth R Westerback @@ -130,7 +130,7 @@ check_route_label(struct sockaddr_rtlabel *label) void flush_routes(void) { - int rslt; + int rslt; rslt = imsg_compose(unpriv_ibuf, IMSG_FLUSH_ROUTES, 0, 0, -1, NULL, 0); if (rslt == -1) @@ -236,8 +236,8 @@ priv_flush_routes(char *name, int routefd, int rdomain) void delete_route(int s, struct rt_msghdr *rtm) { - static int seqno; - ssize_t rlen; + static int seqno; + ssize_t rlen; rtm->rtm_type = RTM_DELETE; rtm->rtm_seq = seqno++; @@ -259,7 +259,7 @@ void add_direct_route(struct in_addr dest, struct in_addr mask, struct in_addr iface) { - struct in_addr ifa = { INADDR_ANY }; + struct in_addr ifa = { INADDR_ANY }; add_route(dest, mask, iface, ifa, RTA_DST | RTA_NETMASK | RTA_GATEWAY, RTF_CLONING | RTF_STATIC); @@ -277,8 +277,8 @@ add_direct_route(struct in_addr dest, struct in_addr mask, void add_default_route(struct in_addr addr, struct in_addr gateway) { - struct in_addr netmask, dest; - int addrs, flags; + struct in_addr netmask, dest; + int addrs, flags; memset(&netmask, 0, sizeof(netmask)); memset(&dest, 0, sizeof(dest)); @@ -313,7 +313,7 @@ add_static_routes(struct option_data *static_routes, struct in_addr iface) netmask.s_addr = INADDR_ANY; /* Not used for CLASSFULL! */ for (i = 0; (i + 2*sizeof(*addr)) <= static_routes->len; - i += 2*sizeof(*addr)) { + i += 2*sizeof(*addr)) { addr = (struct in_addr *)&static_routes->data[i]; if (addr->s_addr == INADDR_ANY) continue; /* RFC 2132 says 0.0.0.0 is not allowed. */ @@ -381,7 +381,7 @@ add_classless_static_routes(struct option_data *opt, struct in_addr iface) int create_route_label(struct sockaddr_rtlabel *label) { - int len; + int len; memset(label, 0, sizeof(*label)); @@ -427,13 +427,15 @@ add_route(struct in_addr dest, struct in_addr netmask, void priv_add_route(int rdomain, struct imsg_add_route *imsg) { - char destbuf[INET_ADDRSTRLEN], gatewaybuf[INET_ADDRSTRLEN]; - char maskbuf[INET_ADDRSTRLEN], ifabuf[INET_ADDRSTRLEN]; - struct rt_msghdr rtm; - struct sockaddr_in dest, gateway, mask, ifa; - struct sockaddr_rtlabel label; - struct iovec iov[6]; - int s, i, iovcnt = 0; + char destbuf[INET_ADDRSTRLEN]; + char gatewaybuf[INET_ADDRSTRLEN]; + char maskbuf[INET_ADDRSTRLEN]; + char ifabuf[INET_ADDRSTRLEN]; + struct iovec iov[6]; + struct rt_msghdr rtm; + struct sockaddr_in dest, gateway, mask, ifa; + struct sockaddr_rtlabel label; + int s, i, iovcnt = 0; if ((s = socket(AF_ROUTE, SOCK_RAW, 0)) == -1) fatal("Routing Socket open failed"); @@ -544,8 +546,8 @@ priv_add_route(int rdomain, struct imsg_add_route *imsg) void delete_addresses(char *name) { - struct in_addr addr; - struct ifaddrs *ifap, *ifa; + struct in_addr addr; + struct ifaddrs *ifap, *ifa; if (getifaddrs(&ifap) != 0) fatal("delete_addresses getifaddrs"); @@ -625,8 +627,8 @@ priv_delete_address(char *name, int ioctlfd, struct imsg_delete_address *imsg) void set_interface_mtu(int mtu) { - struct imsg_set_interface_mtu imsg; - int rslt; + struct imsg_set_interface_mtu imsg; + int rslt; imsg.mtu = mtu; @@ -642,7 +644,7 @@ void priv_set_interface_mtu(char *name, int ioctlfd, struct imsg_set_interface_mtu *imsg) { - struct ifreq ifr; + struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); @@ -661,8 +663,8 @@ priv_set_interface_mtu(char *name, int ioctlfd, void add_address(struct in_addr addr, struct in_addr mask) { - struct imsg_add_address imsg; - int rslt; + struct imsg_add_address imsg; + int rslt; /* Note the address we are adding for RTM_NEWADDR filtering! */ adding = addr; @@ -711,7 +713,7 @@ priv_add_address(char *name, int ioctlfd, struct imsg_add_address *imsg) void write_resolv_conf(uint8_t *contents, size_t sz) { - int rslt; + int rslt; rslt = imsg_compose(unpriv_ibuf, IMSG_WRITE_RESOLV_CONF, 0, 0, -1, contents, sz); @@ -753,17 +755,17 @@ priv_write_resolv_conf(uint8_t *contents, size_t sz) int resolv_conf_priority(int rdomain, int routefd) { - struct iovec iov[3]; + struct iovec iov[3]; + struct sockaddr_in sin; struct { struct rt_msghdr m_rtm; char m_space[512]; - } m_rtmsg; - struct sockaddr *rti_info[RTAX_MAX]; - struct sockaddr_in sin; + } m_rtmsg; + struct sockaddr *rti_info[RTAX_MAX]; struct sockaddr_rtlabel *sa_rl; - pid_t pid; - ssize_t len; - int seq, rslt, iovcnt = 0; + pid_t pid; + ssize_t len; + int seq, rslt, iovcnt = 0; rslt = 0; @@ -847,9 +849,9 @@ resolv_conf_contents(char *name, struct option_data *domainname, struct option_data *nameservers, struct option_data *domainsearch) { - char *dn, *ns, *nss[MAXNS], *contents, *courtesy, *p, *buf; - size_t len; - int i, rslt; + char *dn, *ns, *nss[MAXNS], *contents, *courtesy, *p, *buf; + size_t len; + int i, rslt; memset(nss, 0, sizeof(nss)); @@ -937,8 +939,8 @@ resolv_conf_contents(char *name, void populate_rti_info(struct sockaddr **rti_info, struct rt_msghdr *rtm) { - struct sockaddr *sa; - int i; + struct sockaddr *sa; + int i; sa = (struct sockaddr *)((char *)(rtm) + rtm->rtm_hdrlen); diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c index 4498480788d..7b7c6ef4821 100644 --- a/sbin/dhclient/options.c +++ b/sbin/dhclient/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.98 2017/07/09 19:19:58 krw Exp $ */ +/* $OpenBSD: options.c,v 1.99 2017/07/10 00:47:47 krw Exp $ */ /* DHCP options parsing and reassembly. */ @@ -497,7 +497,7 @@ parse_option_buffer(struct option_data *options, unsigned char *buffer, int pack_options(unsigned char *buf, int buflen, struct option_data *options) { - int ix, incr, length, bufix, code, lastopt = -1; + int ix, incr, length, bufix, code, lastopt = -1; memset(buf, 0, buflen); @@ -550,10 +550,10 @@ pack_options(unsigned char *buf, int buflen, struct option_data *options) char * pretty_print_string(unsigned char *src, size_t srclen, int emit_punct) { - static char string[8196]; - char visbuf[5]; - unsigned char *origsrc = src; - size_t rslt = 0; + static char string[8196]; + char visbuf[5]; + unsigned char *origsrc = src; + size_t rslt = 0; memset(string, 0, sizeof(string)); @@ -584,11 +584,11 @@ pretty_print_string(unsigned char *src, size_t srclen, int emit_punct) char * pretty_print_classless_routes(unsigned char *src, size_t srclen) { - static char string[8196]; - char bitsbuf[5]; /* to hold "/nn " */ - struct in_addr net, gateway; - unsigned int bytes; - int bits, rslt; + static char string[8196]; + char bitsbuf[5]; /* to hold "/nn " */ + struct in_addr net, gateway; + unsigned int bytes; + int bits, rslt; memset(string, 0, sizeof(string)); @@ -630,9 +630,9 @@ int expand_search_domain_name(unsigned char *src, size_t srclen, int *offset, unsigned char *domain_search) { - unsigned int i; - int domain_name_len, label_len, pointer, pointed_len; - char *cursor; + char *cursor; + unsigned int i; + int domain_name_len, label_len, pointer, pointed_len; cursor = domain_search + strlen(domain_search); domain_name_len = 0; @@ -712,10 +712,10 @@ expand_search_domain_name(unsigned char *src, size_t srclen, int *offset, char * pretty_print_domain_search(unsigned char *src, size_t srclen) { - static char domain_search[DHCP_DOMAIN_SEARCH_LEN]; - unsigned int offset; - int len, expanded_len, domains; - unsigned char *cursor; + static char domain_search[DHCP_DOMAIN_SEARCH_LEN]; + unsigned char *cursor; + unsigned int offset; + int len, expanded_len, domains; memset(domain_search, 0, sizeof(domain_search)); @@ -965,8 +965,8 @@ toobig: struct option_data * unpack_options(struct dhcp_packet *packet) { - static struct option_data options[DHO_COUNT]; - int i; + static struct option_data options[DHO_COUNT]; + int i; for (i = 0; i < DHO_COUNT; i++) { free(options[i].data); diff --git a/sbin/dhclient/packet.c b/sbin/dhclient/packet.c index 603bc5003c6..24bc629fd43 100644 --- a/sbin/dhclient/packet.c +++ b/sbin/dhclient/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.38 2017/07/09 19:19:58 krw Exp $ */ +/* $OpenBSD: packet.c,v 1.39 2017/07/10 00:47:47 krw Exp $ */ /* Packet assembly code, originally contributed by Archie Cobbs. */ @@ -62,7 +62,7 @@ uint32_t checksum(unsigned char *buf, uint32_t nbytes, uint32_t sum) { - unsigned int i; + unsigned int i; /* Checksum all the pairs of bytes first. */ for (i = 0; i < (nbytes & ~1U); i += 2) { @@ -106,7 +106,7 @@ assemble_eh_header(struct ether_addr shost, struct ether_header *eh) ssize_t decode_hw_header(unsigned char *buf, uint32_t buflen, struct ether_addr *from) { - struct ether_header eh; + struct ether_header eh; if (buflen < sizeof(eh)) return -1; diff --git a/sbin/dhclient/parse.c b/sbin/dhclient/parse.c index 1dc5feb64c6..61e0630c93a 100644 --- a/sbin/dhclient/parse.c +++ b/sbin/dhclient/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.57 2017/07/09 19:19:58 krw Exp $ */ +/* $OpenBSD: parse.c,v 1.58 2017/07/10 00:47:47 krw Exp $ */ /* Common parser code for dhcpd and dhclient. */ @@ -131,9 +131,9 @@ parse_semi(FILE *cfile) char * parse_string(FILE *cfile, unsigned int *len) { - static char unvisbuf[1500]; - char *val, *s; - int i, token; + static char unvisbuf[1500]; + char *val, *s; + int i, token; token = next_token(&val, cfile); if (token != TOK_STRING) { @@ -165,9 +165,9 @@ parse_string(FILE *cfile, unsigned int *len) int parse_cidr(FILE *cfile, unsigned char *cidr) { - struct in_addr addr; - int token; - int len; + struct in_addr addr; + int token; + int len; token = '.'; len = 0; @@ -200,8 +200,8 @@ parse_cidr(FILE *cfile, unsigned char *cidr) int parse_ip_addr(FILE *cfile, struct in_addr *addr) { - struct in_addr buf; - int len, token; + struct in_addr buf; + int len, token; token = '.'; len = 0; @@ -232,7 +232,7 @@ parse_ip_addr(FILE *cfile, struct in_addr *addr) void parse_lease_time(FILE *cfile, time_t *timep) { - uint32_t value; + uint32_t value; if (!parse_decimal(cfile, (char *)&value, 'L')) { parse_warn("expecting unsigned 32-bit decimal value."); @@ -271,10 +271,10 @@ parse_boolean(FILE *cfile, unsigned char *buf) int parse_decimal(FILE *cfile, unsigned char *buf, char fmt) { - char *val; - const char *errstr; - int bytes, token; - long long numval, low, high; + const char *errstr; + char *val; + int bytes, token; + long long numval, low, high; token = next_token(&val, cfile); @@ -316,9 +316,9 @@ parse_decimal(FILE *cfile, unsigned char *buf, char fmt) int parse_hex(FILE *cfile, unsigned char *buf) { - char *val, *ep; - int token; - unsigned long ulval; + char *val, *ep; + unsigned long ulval; + int token; token = next_token(&val, cfile); @@ -345,12 +345,12 @@ parse_hex(FILE *cfile, unsigned char *buf) time_t parse_date(FILE *cfile) { - struct tm tm; char timestr[26]; /* "w yyyy/mm/dd hh:mm:ss UTC" */ - char *val, *p; - size_t n; - time_t guess; - int token; + struct tm tm; + char *val, *p; + size_t n; + time_t guess; + int token; memset(timestr, 0, sizeof(timestr)); @@ -401,8 +401,8 @@ parse_date(FILE *cfile) void parse_warn(char *msg) { - static char spaces[81]; - unsigned int i; + static char spaces[81]; + unsigned int i; log_warnx("%s line %d: %s", tlname, lexline, msg); log_warnx("%s", token_line);