diff options
author | Luis R. Rodriguez <mcgrof@do-not-panic.com> | 2013-05-24 18:24:04 -0700 |
---|---|---|
committer | Luis R. Rodriguez <mcgrof@do-not-panic.com> | 2013-05-25 11:56:46 -0700 |
commit | c5505f6e9e887f80cc5ecbe6059a18b18d82620b (patch) | |
tree | ae54aee139e111e110df3695b8f6d2627da5d401 | |
parent | abea6f74f14a8d23674cffedcc994730146df34d (diff) | |
download | crda-c5505f6e9e887f80cc5ecbe6059a18b18d82620b.tar.gz |
crda: do not double count on reglib_for_each_country()
Commit ebcbfcf4 introduced reglib_for_each_country() used
by regdbump and later intersect. This helper however only
increased the index count after we requestd getting a new
regulatory domain, this is incorrect and causes us to iterate
over the same element twice in the beginning. This means
intersection and regdb printing was going over the first
element twice. This has been present since v1.1.
This also requires an adjustment on intersect due to the
way things were being handled before.
mcgrof@frijol ~/devel/crda (git::master)$ git describe --contains ebcbfcf4
v1.1.3~9
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
-rw-r--r-- | intersect.c | 10 | ||||
-rw-r--r-- | reglib.h | 3 |
2 files changed, 4 insertions, 9 deletions
diff --git a/intersect.c b/intersect.c index 5cb7d7c..dea9145 100644 --- a/intersect.c +++ b/intersect.c @@ -79,16 +79,12 @@ int main(int argc, char **argv) return -EINVAL; } - if (idx == 1) { - world = (struct ieee80211_regdomain *) rd; - rd = NULL; - } - - if (intersected > 1) printf("%d regulatory domains intersected\n", intersected); - else + else { + world = prev_world; printf("Only one intersection completed\n"); + } /* Tada! */ printf("== World regulatory domain: ==\n"); @@ -79,8 +79,7 @@ reglib_get_rd_idx(unsigned int idx, const char *file); #define reglib_for_each_country(__rd, __idx, __file) \ for (__rd = reglib_get_rd_idx(__idx, __file); \ __rd != NULL; \ - __rd = reglib_get_rd_idx(__idx, __file), \ - __idx++) + __rd = reglib_get_rd_idx(++__idx, __file)) \ const struct ieee80211_regdomain * reglib_get_rd_alpha2(const char *alpha2, const char *file); |