[svn-commits] eliel: branch group/data_api_gsoc2009 r205660 - /team/group/data_api_gsoc2009...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 9 13:03:52 CDT 2009


Author: eliel
Date: Thu Jul  9 13:03:49 2009
New Revision: 205660

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205660
Log:
Follow the coding guidelines when casting.
Move a while() into a for().


Modified:
    team/group/data_api_gsoc2009/main/data.c

Modified: team/group/data_api_gsoc2009/main/data.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/main/data.c?view=diff&rev=205660&r1=205659&r2=205660
==============================================================================
--- team/group/data_api_gsoc2009/main/data.c (original)
+++ team/group/data_api_gsoc2009/main/data.c Thu Jul  9 13:03:49 2009
@@ -776,15 +776,13 @@
 
 	search_string_dup = ast_strdupa(search_string);
 
-	elements = strtok(search_string_dup, ",");
-
 	/* Create the root node (just used as a container) */
 	root = data_search_alloc("/");
 	if (!root) {
 		return NULL;
 	}
 
-	while (elements) {
+	for (elements = strtok(search_string_dup, ","); elements; elements = strtok(NULL, ",")) {
 		/* Parse the name */
 		ast_str_reset(name);
 		for (i = 0; !data_search_comparison_char(elements[i]) &&
@@ -826,8 +824,6 @@
 		}
 
 		ao2_ref(child, -1);
-
-		elements = strtok(NULL, ",");
 	}
 
 	return root;
@@ -1534,23 +1530,23 @@
 
 	switch (type) {
 	case AST_DATA_BOOLEAN:
-		node->payload.boolean = *(unsigned int *)ptr;
+		node->payload.boolean = *(unsigned int *) ptr;
 		break;
 	case AST_DATA_INTEGER:
-		node->payload.sint = *(unsigned int *)ptr;
+		node->payload.sint = *(unsigned int *) ptr;
 		break;
 	case AST_DATA_UNSIGNED_INTEGER:
-		node->payload.sint = *(unsigned int *)ptr;
+		node->payload.sint = *(unsigned int *) ptr;
 		break;
 	case AST_DATA_DOUBLE:
-		node->payload.dbl = *(double *)ptr;
+		node->payload.dbl = *(double *) ptr;
 		break;
 	case AST_DATA_STRING:
 	case AST_DATA_POINTER:
 		node->payload.ptr = ptr;
 		break;
 	case AST_DATA_IPADDR:
-		node->payload.ipaddr = *(struct in_addr *)ptr;
+		node->payload.ipaddr = *(struct in_addr *) ptr;
 		break;
 	case AST_DATA_CONTAINER:
 	default:




More information about the svn-commits mailing list