summaryrefslogtreecommitdiff
path: root/reglib.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2008-10-29 01:53:13 -0700
committerLuis R. Rodriguez <lrodriguez@atheros.com>2008-10-29 01:53:13 -0700
commit55ac9f8d1f8a66b1a46bf82e7fe8f184f75488cc (patch)
treebede549f737cd310915eb0d0f44ce796d88f0c33 /reglib.c
parent84ff22a581b17fdc6702d45cbdc257cdd5da106a (diff)
downloadcrda-55ac9f8d1f8a66b1a46bf82e7fe8f184f75488cc.tar.gz
crda-55ac9f8d1f8a66b1a46bf82e7fe8f184f75488cc.tar.bz2
crda-55ac9f8d1f8a66b1a46bf82e7fe8f184f75488cc.zip
Double pointers obfuscate code, die
Lets make country2rd() easier to read by not using double pointers. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Diffstat (limited to 'reglib.c')
-rw-r--r--reglib.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/reglib.c b/reglib.c
index feb4af8..e6b9b3f 100644
--- a/reglib.c
+++ b/reglib.c
@@ -158,9 +158,8 @@ void reg_rule2rd(__u8 *db, int dblen,
}
/* Converts a file regdomain to ieee80211_regdomain, easier to manage */
-int country2rd(__u8 *db, int dblen,
- struct regdb_file_reg_country *country,
- struct ieee80211_regdomain **rdp)
+struct ieee80211_regdomain *country2rd(__u8 *db, int dblen,
+ struct regdb_file_reg_country *country)
{
struct regdb_file_reg_rules_collection *rcoll;
struct ieee80211_regdomain *rd;
@@ -177,11 +176,9 @@ int country2rd(__u8 *db, int dblen,
size_of_rd = sizeof(struct ieee80211_regdomain) +
num_rules * sizeof(struct ieee80211_reg_rule);
- *rdp = malloc(size_of_rd);
- if (!*rdp)
- return -ENOMEM;
-
- rd = *rdp;
+ rd = malloc(size_of_rd);
+ if (!rd)
+ return NULL;
memset(rd, 0, size_of_rd);
@@ -194,7 +191,7 @@ int country2rd(__u8 *db, int dblen,
&rd->reg_rules[i]);
}
- return 0;
+ return rd;
}
/* Sanity check on a regulatory rule */