diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2008-10-29 01:53:13 -0700 |
---|---|---|
committer | Luis R. Rodriguez <lrodriguez@atheros.com> | 2008-10-29 01:53:13 -0700 |
commit | 55ac9f8d1f8a66b1a46bf82e7fe8f184f75488cc (patch) | |
tree | bede549f737cd310915eb0d0f44ce796d88f0c33 /reglib.c | |
parent | 84ff22a581b17fdc6702d45cbdc257cdd5da106a (diff) | |
download | crda-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.c | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -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 */ |