Skip to content
Snippets Groups Projects
Commit abdd9fa1 authored by Corey Farrell's avatar Corey Farrell
Browse files

aoc: Remove silly usage of RAII_VAR.

Change-Id: I07907f833b81aeb0128bc9442a2abb52679c7511
parent 7c3bf5af
No related branches found
No related tags found
No related merge requests found
...@@ -1663,7 +1663,7 @@ static struct ast_json *currency_to_json(const char *name, int cost, ...@@ -1663,7 +1663,7 @@ static struct ast_json *currency_to_json(const char *name, int cost,
static struct ast_json *charge_to_json(const struct ast_aoc_decoded *decoded) static struct ast_json *charge_to_json(const struct ast_aoc_decoded *decoded)
{ {
RAII_VAR(struct ast_json *, obj, NULL, ast_json_unref); struct ast_json *obj;
const char *obj_type; const char *obj_type;
if (decoded->charge_type != AST_AOC_CHARGE_CURRENCY && if (decoded->charge_type != AST_AOC_CHARGE_CURRENCY &&
...@@ -1685,7 +1685,7 @@ static struct ast_json *charge_to_json(const struct ast_aoc_decoded *decoded) ...@@ -1685,7 +1685,7 @@ static struct ast_json *charge_to_json(const struct ast_aoc_decoded *decoded)
"Type", aoc_charge_type_str(decoded->charge_type), "Type", aoc_charge_type_str(decoded->charge_type),
"BillingID", aoc_billingid_str(decoded->billing_id), "BillingID", aoc_billingid_str(decoded->billing_id),
"TotalType", aoc_type_of_totaling_str(decoded->total_type), "TotalType", aoc_type_of_totaling_str(decoded->total_type),
obj_type, ast_json_ref(obj)); obj_type, obj);
} }
static struct ast_json *association_to_json(const struct ast_aoc_decoded *decoded) static struct ast_json *association_to_json(const struct ast_aoc_decoded *decoded)
...@@ -1714,8 +1714,8 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded) ...@@ -1714,8 +1714,8 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
for (i = 0; i < decoded->aoc_s_count; ++i) { for (i = 0; i < decoded->aoc_s_count; ++i) {
struct ast_json *rate; struct ast_json *rate;
RAII_VAR(struct ast_json *, type, NULL, ast_json_unref); struct ast_json *type = NULL;
RAII_VAR(struct ast_json *, currency, NULL, ast_json_unref); struct ast_json *currency;
const char *charge_item = aoc_charged_item_str( const char *charge_item = aoc_charged_item_str(
decoded->aoc_s_entries[i].charged_item); decoded->aoc_s_entries[i].charged_item);
...@@ -1730,8 +1730,8 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded) ...@@ -1730,8 +1730,8 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
switch (decoded->aoc_s_entries[i].rate_type) { switch (decoded->aoc_s_entries[i].rate_type) {
case AST_AOC_RATE_TYPE_DURATION: case AST_AOC_RATE_TYPE_DURATION:
{ {
RAII_VAR(struct ast_json *, time, NULL, ast_json_unref); struct ast_json *time;
RAII_VAR(struct ast_json *, granularity, NULL, ast_json_unref); struct ast_json *granularity = NULL;
currency = currency_to_json( currency = currency_to_json(
decoded->aoc_s_entries[i].rate.duration.currency_name, decoded->aoc_s_entries[i].rate.duration.currency_name,
...@@ -1749,11 +1749,11 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded) ...@@ -1749,11 +1749,11 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
} }
type = ast_json_pack("{s:o, s:s, s:o, s:o}", type = ast_json_pack("{s:o, s:s, s:o, s:o}",
"Currency", ast_json_ref(currency), "Currency", currency,
"ChargingType", decoded->aoc_s_entries[i].rate.duration.charging_type "ChargingType", decoded->aoc_s_entries[i].rate.duration.charging_type
? "StepFunction" : "ContinuousCharging", ? "StepFunction" : "ContinuousCharging",
"Time", ast_json_ref(time), "Time", time,
"Granularity", granularity ? ast_json_ref(granularity) : ast_json_null()); "Granularity", granularity ?: ast_json_null());
break; break;
} }
...@@ -1763,7 +1763,7 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded) ...@@ -1763,7 +1763,7 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
decoded->aoc_s_entries[i].rate.flat.amount, decoded->aoc_s_entries[i].rate.flat.amount,
decoded->aoc_s_entries[i].rate.flat.multiplier); decoded->aoc_s_entries[i].rate.flat.multiplier);
type = ast_json_pack("{s:o}", "Currency", ast_json_ref(currency)); type = ast_json_pack("{s:o}", "Currency", currency);
break; break;
case AST_AOC_RATE_TYPE_VOLUME: case AST_AOC_RATE_TYPE_VOLUME:
currency = currency_to_json( currency = currency_to_json(
...@@ -1774,7 +1774,7 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded) ...@@ -1774,7 +1774,7 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
type = ast_json_pack("{s:s, s:o}", type = ast_json_pack("{s:s, s:o}",
"Unit", aoc_volume_unit_str( "Unit", aoc_volume_unit_str(
decoded->aoc_s_entries[i].rate.volume.volume_unit), decoded->aoc_s_entries[i].rate.volume.volume_unit),
"Currency", ast_json_ref(currency)); "Currency", currency);
break; break;
case AST_AOC_RATE_TYPE_SPECIAL_CODE: case AST_AOC_RATE_TYPE_SPECIAL_CODE:
type = ast_json_pack("{s:i}", type = ast_json_pack("{s:i}",
...@@ -1786,7 +1786,7 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded) ...@@ -1786,7 +1786,7 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
rate = ast_json_pack("{s:s, s:o}", rate = ast_json_pack("{s:s, s:o}",
"Chargeable", charge_item, "Chargeable", charge_item,
aoc_rate_type_str(decoded->aoc_s_entries[i].rate_type), ast_json_ref(type)); aoc_rate_type_str(decoded->aoc_s_entries[i].rate_type), type);
if (ast_json_array_append(rates, rate)) { if (ast_json_array_append(rates, rate)) {
break; break;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment