Skip to content

Commit 1c2fb47

Browse files
committed
crda: pass struct reglib_regdb_ctx to country2rd()
This consolidates the number of arguments. Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
1 parent ad2f359 commit 1c2fb47

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

reglib.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -298,18 +298,18 @@ static void reg_rule2rd(uint8_t *db, int dblen,
298298

299299
/* Converts a file regdomain to ieee80211_regdomain, easier to manage */
300300
const static struct ieee80211_regdomain *
301-
country2rd(uint8_t *db, int dblen,
301+
country2rd(const struct reglib_regdb_ctx *ctx,
302302
struct regdb_file_reg_country *country)
303303
{
304304
struct regdb_file_reg_rules_collection *rcoll;
305305
struct ieee80211_regdomain *rd;
306306
int i, num_rules, size_of_rd;
307307

308-
rcoll = reglib_get_file_ptr(db, dblen, sizeof(*rcoll),
309-
country->reg_collection_ptr);
308+
rcoll = reglib_get_file_ptr(ctx->db, ctx->dblen, sizeof(*rcoll),
309+
country->reg_collection_ptr);
310310
num_rules = ntohl(rcoll->reg_rule_num);
311311
/* re-get pointer with sanity checking for num_rules */
312-
rcoll = reglib_get_file_ptr(db, dblen,
312+
rcoll = reglib_get_file_ptr(ctx->db, ctx->dblen,
313313
sizeof(*rcoll) + num_rules * sizeof(uint32_t),
314314
country->reg_collection_ptr);
315315

@@ -328,7 +328,7 @@ country2rd(uint8_t *db, int dblen,
328328
rd->n_reg_rules = num_rules;
329329

330330
for (i = 0; i < num_rules; i++) {
331-
reg_rule2rd(db, dblen, rcoll->reg_rule_ptrs[i],
331+
reg_rule2rd(ctx->db, ctx->dblen, rcoll->reg_rule_ptrs[i],
332332
&rd->reg_rules[i]);
333333
}
334334

@@ -351,7 +351,7 @@ reglib_get_rd_idx(unsigned int idx, const char *file)
351351

352352
country = ctx->countries + idx;
353353

354-
rd = country2rd(ctx->db, ctx->dblen, country);
354+
rd = country2rd(ctx, country);
355355
if (!rd)
356356
goto out;
357357

@@ -384,7 +384,7 @@ reglib_get_rd_alpha2(const char *alpha2, const char *file)
384384
if (!found_country)
385385
goto out;
386386

387-
rd = country2rd(ctx->db, ctx->dblen, country);
387+
rd = country2rd(ctx, country);
388388
if (!rd)
389389
goto out;
390390

0 commit comments

Comments
 (0)