aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-05-24 18:24:04 -0700
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-05-25 11:56:46 -0700
commitc5505f6e9e887f80cc5ecbe6059a18b18d82620b (patch)
treeae54aee139e111e110df3695b8f6d2627da5d401
parentabea6f74f14a8d23674cffedcc994730146df34d (diff)
downloadcrda-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.c10
-rw-r--r--reglib.h3
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");
diff --git a/reglib.h b/reglib.h
index b52d717..8bd9e03 100644
--- a/reglib.h
+++ b/reglib.h
@@ -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);