pike(s): gcc 2.9x var decls. fixes
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Wed, 30 Sep 2009 23:26:13 +0000 (01:26 +0200)
committerAndrei Pelinescu-Onciul <andrei@iptel.org>
Wed, 30 Sep 2009 23:29:18 +0000 (01:29 +0200)
variable declarations must be at the beginning of the function and
not intercalated in the code.

modules_s/pike/rpc.c
modules_s/pike/top.c

index 95ed557..25b0687 100644 (file)
@@ -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)
index 6de82eb..cb42546 100644 (file)
@@ -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);