浏览代码

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

variable declarations must be at the beginning of the function and
not intercalated in the code.
Andrei Pelinescu-Onciul 16 年之前
父节点
当前提交
c60ba81953
共有 2 个文件被更改,包括 9 次插入7 次删除
  1. 2 4
      modules_s/pike/rpc.c
  2. 7 3
      modules_s/pike/top.c

+ 2 - 4
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)

+ 7 - 3
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);