[sr-dev] git:master: pike(s): gcc 2.9x var decls. fixes

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Oct 1 01:29:30 CEST 2009


Module: sip-router
Branch: master
Commit: c60ba81953e59f57ad3d11f4ec2918120f7b924e
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c60ba81953e59f57ad3d11f4ec2918120f7b924e

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Thu Oct  1 01:26:13 2009 +0200

pike(s): gcc 2.9x var decls. fixes

variable declarations must be at the beginning of the function and
not intercalated in the code.

---

 modules_s/pike/rpc.c |    6 ++----
 modules_s/pike/top.c |   10 +++++++---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules_s/pike/rpc.c b/modules_s/pike/rpc.c
index 95ed557..25b0687 100644
--- a/modules_s/pike/rpc.c
+++ b/modules_s/pike/rpc.c
@@ -99,9 +99,6 @@ static char *concat(char *buff, size_t buffsize, const char *first, int second)
 
 static void pike_top(rpc_t *rpc, void *c)
 {
-
-	DBG("pike: top");
-
 	int i;
 	void *handle;
 	struct TopListItem_t *top_list_root;
@@ -117,9 +114,10 @@ static void pike_top(rpc_t *rpc, void *c)
 	size_t leaf_hits_curr_size = 0;
 	size_t expires_size = 0;
 	size_t status_size = 0;
-	
 	char *stropts;
 	int   options = 0;
+
+	DBG("pike: top");
 	
 	/* obtain params */
 	if (rpc->scan(c, "s", &stropts) <= 0)
diff --git a/modules_s/pike/top.c b/modules_s/pike/top.c
index 6de82eb..cb42546 100644
--- a/modules_s/pike/top.c
+++ b/modules_s/pike/top.c
@@ -46,9 +46,13 @@ static char *print_addr(unsigned char *ip, int iplen)
 
 int pike_top_add_entry( unsigned char *ip_addr, int addr_len, unsigned int leaf_hits[2], unsigned int hits[2], unsigned int expires, node_status_t status )
 {
-	print_addr(ip_addr, addr_len);
-	DBG("pike_top_add_enrty(ip: %s, leaf_hits[%d,%d], hits[%d,%d], expires: %d, status: %d)", buff, leaf_hits[0], leaf_hits[1], hits[0], hits[1], expires, status);
 	struct TopListItem_t *new_item = (struct TopListItem_t *)malloc(sizeof(struct TopListItem_t));
+	
+	print_addr(ip_addr, addr_len);
+	DBG("pike_top_add_enrty(ip: %s, leaf_hits[%d,%d], hits[%d,%d],"
+			" expires: %d, status: %d)",
+			buff, leaf_hits[0], leaf_hits[1], hits[0], hits[1],
+			expires, status);
 	assert(new_item != 0);
 	
 	memset( (void *)new_item, 0, sizeof(struct TopListItem_t) );
@@ -73,9 +77,9 @@ int pike_top_add_entry( unsigned char *ip_addr, int addr_len, unsigned int leaf_
 
 void pike_top_list_clear()
 {
-	top_list_iter = top_list_root;
 	struct TopListItem_t *ptr;
 	
+	top_list_iter = top_list_root;
 	while (top_list_iter) {
 		ptr = top_list_iter->next;
 		free(top_list_iter);




More information about the sr-dev mailing list