[svn-commits] dvossel: branch group/aoc r251497 - /team/group/aoc/main/aoc.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Mar 9 14:43:56 CST 2010


Author: dvossel
Date: Tue Mar  9 14:43:52 2010
New Revision: 251497

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=251497
Log:
improvements made while reviewing code

Modified:
    team/group/aoc/main/aoc.c

Modified: team/group/aoc/main/aoc.c
URL: http://svnview.digium.com/svn/asterisk/team/group/aoc/main/aoc.c?view=diff&rev=251497&r1=251496&r2=251497
==============================================================================
--- team/group/aoc/main/aoc.c (original)
+++ team/group/aoc/main/aoc.c Tue Mar  9 14:43:52 2010
@@ -29,10 +29,6 @@
 #include "asterisk/aoc.h"
 #include "asterisk/utils.h"
 #include "asterisk/strings.h"
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
 #include "asterisk/_private.h"
 
 
@@ -224,7 +220,7 @@
 
 struct ast_aoc_decoded *ast_aoc_decode(struct ast_aoc_encoded *encoded, size_t size)
 {
-	struct ast_aoc_decoded *decoded = ast_calloc(1, sizeof(struct ast_aoc_decoded));
+	struct ast_aoc_decoded *decoded;
 
 	/* verify our encoded payload is actually large enough to hold all the ies */
 	if ((size - (sizeof(struct ast_aoc_encoded)) != ntohs(encoded->datalen))) {
@@ -232,7 +228,7 @@
 		return NULL;
 	}
 
-	if (!decoded) {
+	if (!(decoded = ast_calloc(1, sizeof(struct ast_aoc_decoded)))) {
 		ast_log(LOG_WARNING, "Failed to create ast_aoc_decoded object \n");
 		return NULL;
 	}
@@ -347,7 +343,7 @@
 {
 	struct aoc_ie_data ied;
 	struct ast_aoc_encoded *encoded;
-	unsigned int size = 0;
+	size_t size = 0;
 
 	if (!decoded || !encoded_out) {
 		return 0;
@@ -460,9 +456,7 @@
 {
 
 	if (!ast_strlen_zero(name)) {
-		ast_copy_string(decoded->currency_name,
-			name,
-			sizeof(decoded->currency_name));
+		ast_copy_string(decoded->currency_name, name, sizeof(decoded->currency_name));
 	}
 
 	decoded->currency_amount = amount;




More information about the svn-commits mailing list