mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
aoc.c: Whitespace cleanup
* In s_to_json() removed unnecessary ast_json_ref() to ast_json_null() when creating the type json object. The ref is a noop. Change-Id: I2be8b836876fc2e34a27c161f8b1c53b58a3889a
This commit is contained in:
33
main/aoc.c
33
main/aoc.c
@@ -1667,8 +1667,8 @@ static struct ast_json *charge_to_json(const struct ast_aoc_decoded *decoded)
|
|||||||
|
|
||||||
if (decoded->charge_type != AST_AOC_CHARGE_CURRENCY &&
|
if (decoded->charge_type != AST_AOC_CHARGE_CURRENCY &&
|
||||||
decoded->charge_type != AST_AOC_CHARGE_UNIT) {
|
decoded->charge_type != AST_AOC_CHARGE_UNIT) {
|
||||||
return ast_json_pack("{s:s}", "Type",
|
return ast_json_pack("{s:s}",
|
||||||
aoc_charge_type_str(decoded->charge_type));
|
"Type", aoc_charge_type_str(decoded->charge_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decoded->charge_type == AST_AOC_CHARGE_CURRENCY) {
|
if (decoded->charge_type == AST_AOC_CHARGE_CURRENCY) {
|
||||||
@@ -1680,8 +1680,7 @@ static struct ast_json *charge_to_json(const struct ast_aoc_decoded *decoded)
|
|||||||
obj = units_to_json(decoded);
|
obj = units_to_json(decoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ast_json_pack(
|
return ast_json_pack("{s:s, s:s, s:s, s:o}",
|
||||||
"{s:s, s:s, s:s, s:o}",
|
|
||||||
"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),
|
||||||
@@ -1697,8 +1696,7 @@ static struct ast_json *association_to_json(const struct ast_aoc_decoded *decode
|
|||||||
"Number", decoded->charging_association.charge.number.number,
|
"Number", decoded->charging_association.charge.number.number,
|
||||||
"Plan", decoded->charging_association.charge.number.plan);
|
"Plan", decoded->charging_association.charge.number.plan);
|
||||||
case AST_AOC_CHARGING_ASSOCIATION_ID:
|
case AST_AOC_CHARGING_ASSOCIATION_ID:
|
||||||
return ast_json_pack(
|
return ast_json_pack("{s:i}", "ID", decoded->charging_association.charge.id);
|
||||||
"{s:i}", "ID", decoded->charging_association.charge.id);
|
|
||||||
case AST_AOC_CHARGING_ASSOCIATION_NA:
|
case AST_AOC_CHARGING_ASSOCIATION_NA:
|
||||||
default:
|
default:
|
||||||
return ast_json_null();
|
return ast_json_null();
|
||||||
@@ -1752,10 +1750,12 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
|
|||||||
"Scale", decoded->aoc_s_entries[i].rate.duration.granularity_time_scale);
|
"Scale", decoded->aoc_s_entries[i].rate.duration.granularity_time_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
type = ast_json_pack("{s:o, s:s, s:o, s:o}", "Currency", ast_json_ref(currency), "ChargingType",
|
type = ast_json_pack("{s:o, s:s, s:o, s:o}",
|
||||||
decoded->aoc_s_entries[i].rate.duration.charging_type ?
|
"Currency", ast_json_ref(currency),
|
||||||
"StepFunction" : "ContinuousCharging", "Time", ast_json_ref(time),
|
"ChargingType", decoded->aoc_s_entries[i].rate.duration.charging_type
|
||||||
"Granularity", granularity ? ast_json_ref(granularity) : ast_json_ref(ast_json_null()));
|
? "StepFunction" : "ContinuousCharging",
|
||||||
|
"Time", ast_json_ref(time),
|
||||||
|
"Granularity", granularity ? ast_json_ref(granularity) : ast_json_null());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1773,21 +1773,22 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
|
|||||||
decoded->aoc_s_entries[i].rate.volume.amount,
|
decoded->aoc_s_entries[i].rate.volume.amount,
|
||||||
decoded->aoc_s_entries[i].rate.volume.multiplier);
|
decoded->aoc_s_entries[i].rate.volume.multiplier);
|
||||||
|
|
||||||
type = ast_json_pack(
|
type = ast_json_pack("{s:s, s:o}",
|
||||||
"{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", ast_json_ref(currency));
|
||||||
break;
|
break;
|
||||||
case AST_AOC_RATE_TYPE_SPECIAL_CODE:
|
case AST_AOC_RATE_TYPE_SPECIAL_CODE:
|
||||||
type = ast_json_pack("{s:i}", "SpecialCode",
|
type = ast_json_pack("{s:i}",
|
||||||
decoded->aoc_s_entries[i].rate.special_code);
|
"SpecialCode", decoded->aoc_s_entries[i].rate.special_code);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rate = ast_json_pack("{s:s, s:o}", "Chargeable", charge_item,
|
rate = ast_json_pack("{s:s, s:o}",
|
||||||
aoc_rate_type_str(decoded->aoc_s_entries[i].rate_type), ast_json_ref(type));
|
"Chargeable", charge_item,
|
||||||
|
aoc_rate_type_str(decoded->aoc_s_entries[i].rate_type), ast_json_ref(type));
|
||||||
if (ast_json_array_append(rates, rate)) {
|
if (ast_json_array_append(rates, rate)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user