[Asterisk-code-review] aoc.c: Whitespace cleanup (asterisk[14])

Anonymous Coward asteriskteam at digium.com
Fri Oct 14 11:01:24 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: aoc.c: Whitespace cleanup
......................................................................


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
---
M main/aoc.c
1 file changed, 17 insertions(+), 16 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/main/aoc.c b/main/aoc.c
index cd9c461..b98bfa7 100644
--- a/main/aoc.c
+++ b/main/aoc.c
@@ -1667,8 +1667,8 @@
 
 	if (decoded->charge_type != AST_AOC_CHARGE_CURRENCY &&
 	    decoded->charge_type != AST_AOC_CHARGE_UNIT) {
-		return ast_json_pack("{s:s}", "Type",
-				     aoc_charge_type_str(decoded->charge_type));
+		return ast_json_pack("{s:s}",
+			"Type", aoc_charge_type_str(decoded->charge_type));
 	}
 
 	if (decoded->charge_type == AST_AOC_CHARGE_CURRENCY) {
@@ -1680,8 +1680,7 @@
 		obj = units_to_json(decoded);
 	}
 
-	return ast_json_pack(
-		"{s:s, s:s, s:s, s:o}",
+	return ast_json_pack("{s:s, s:s, s:s, s:o}",
 		"Type", aoc_charge_type_str(decoded->charge_type),
 		"BillingID", aoc_billingid_str(decoded->billing_id),
 		"TotalType", aoc_type_of_totaling_str(decoded->total_type),
@@ -1697,8 +1696,7 @@
 			"Number", decoded->charging_association.charge.number.number,
 			"Plan", decoded->charging_association.charge.number.plan);
 	case AST_AOC_CHARGING_ASSOCIATION_ID:
-		return ast_json_pack(
-			"{s:i}", "ID", decoded->charging_association.charge.id);
+		return ast_json_pack("{s:i}", "ID", decoded->charging_association.charge.id);
 	case AST_AOC_CHARGING_ASSOCIATION_NA:
 	default:
 		return ast_json_null();
@@ -1752,10 +1750,12 @@
 					"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",
-					     decoded->aoc_s_entries[i].rate.duration.charging_type ?
-					     "StepFunction" : "ContinuousCharging", "Time", ast_json_ref(time),
-					     "Granularity", granularity ? ast_json_ref(granularity) : ast_json_ref(ast_json_null()));
+			type = ast_json_pack("{s:o, s:s, s:o, s:o}",
+				"Currency", ast_json_ref(currency),
+				"ChargingType", decoded->aoc_s_entries[i].rate.duration.charging_type
+					? "StepFunction" : "ContinuousCharging",
+				"Time", ast_json_ref(time),
+				"Granularity", granularity ? ast_json_ref(granularity) : ast_json_null());
 
 			break;
 		}
@@ -1773,21 +1773,22 @@
 				decoded->aoc_s_entries[i].rate.volume.amount,
 				decoded->aoc_s_entries[i].rate.volume.multiplier);
 
-			type = ast_json_pack(
-				"{s:s, s:o}", "Unit", aoc_volume_unit_str(
+			type = ast_json_pack("{s:s, s:o}",
+				"Unit", aoc_volume_unit_str(
 					decoded->aoc_s_entries[i].rate.volume.volume_unit),
 				"Currency", ast_json_ref(currency));
 			break;
 		case AST_AOC_RATE_TYPE_SPECIAL_CODE:
-			type = ast_json_pack("{s:i}", "SpecialCode",
-					    decoded->aoc_s_entries[i].rate.special_code);
+			type = ast_json_pack("{s:i}",
+				"SpecialCode", decoded->aoc_s_entries[i].rate.special_code);
 			break;
 		default:
 			break;
 		}
 
-		rate = ast_json_pack("{s:s, s:o}", "Chargeable", charge_item,
-				     aoc_rate_type_str(decoded->aoc_s_entries[i].rate_type), ast_json_ref(type));
+		rate = ast_json_pack("{s:s, s:o}",
+			"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)) {
 			break;
 		}

-- 
To view, visit https://gerrit.asterisk.org/4093
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2be8b836876fc2e34a27c161f8b1c53b58a3889a
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list