diff options
author | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2014-08-08 15:16:40 +0000 |
---|---|---|
committer | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2014-08-08 15:16:40 +0000 |
commit | 57c01d8977f3de1ebc7e0d60c4a5ca996d72b18d (patch) | |
tree | 95feade3d0e324791a0917b961b045c420f4a86f /sys/net80211/ieee80211_regdomain.c | |
parent | 272c174dabc6806364cb4b27bf617758f9e5818d (diff) |
use nitems() instead of various local constructs
ok stsp@
Diffstat (limited to 'sys/net80211/ieee80211_regdomain.c')
-rw-r--r-- | sys/net80211/ieee80211_regdomain.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/net80211/ieee80211_regdomain.c b/sys/net80211/ieee80211_regdomain.c index e6a64176b3f..c9d34b3d7be 100644 --- a/sys/net80211/ieee80211_regdomain.c +++ b/sys/net80211/ieee80211_regdomain.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_regdomain.c,v 1.7 2006/11/26 19:46:28 deraadt Exp $ */ +/* $OpenBSD: ieee80211_regdomain.c,v 1.8 2014/08/08 15:16:39 jasper Exp $ */ /* * Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org> @@ -101,8 +101,7 @@ ieee80211_name2countrycode(const char *name) const struct ieee80211_countryname key = { CTRY_DEFAULT, name }, *value; if ((value = bsearch(&key, &ieee80211_r_ctry, - sizeof(ieee80211_r_ctry) / sizeof(ieee80211_r_ctry[0]), - sizeof(struct ieee80211_countryname), + nitems(ieee80211_r_ctry), sizeof(struct ieee80211_countryname), ieee80211_regdomain_compare_cn)) != NULL) return (value->cn_code); @@ -119,8 +118,7 @@ ieee80211_name2regdomain(const char *name) key.rn_name = name; if ((value = bsearch(&key, &ieee80211_r_names, - sizeof(ieee80211_r_names) / sizeof(ieee80211_r_names[0]), - sizeof(struct ieee80211_regdomainname), + nitems(ieee80211_r_names), sizeof(struct ieee80211_regdomainname), ieee80211_regdomain_compare_rn)) != NULL) return ((u_int32_t)value->rn_domain); @@ -181,8 +179,7 @@ ieee80211_countrycode2regdomain(u_int16_t code) { int i; - for (i = 0; - i < (sizeof(ieee80211_r_ctry) / sizeof(ieee80211_r_ctry[0])); i++) + for (i = 0; i < nitems(ieee80211_r_ctry); i++) if (ieee80211_r_ctry[i].cn_code == code) return (ieee80211_r_ctry[i].cn_domain); |