[hipl-commit] [trunk] Rev 4266: i3: Mark all functions only used within their files as static.

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Tue, 13 Apr 2010 19:30:16 +0300

Committer: Diego Biurrun <diego@xxxxxxxxxx>
Date: 13/04/2010 at 19:30:16
Revision: 4266
Revision-id: diego@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  i3: Mark all functions only used within their files as static.

Modified:
  M  i3/aeshash/aeshash.c
  M  i3/chord/gen_conf.c
  M  i3/chord/util.c
  M  i3/i3/i3_config.c
  M  i3/i3/i3_options.c
  M  i3/i3/i3_trigger.c
  M  i3/i3_client/coordinates.c
  M  i3/i3_client/http.c
  M  i3/i3_client/i3_client_callback.c
  M  i3/i3_client/i3_client_context.c
  M  i3/i3_client/i3_client_trigger.c
  M  i3/i3_client/i3server_list.c
  M  i3/i3_client/ping_thread.c
  M  i3/utils/event.c
  M  i3/utils/inetfns.c

=== modified file 'i3/aeshash/aeshash.c'
--- i3/aeshash/aeshash.c        2010-02-17 17:38:08 +0000
+++ i3/aeshash/aeshash.c        2010-04-13 16:29:54 +0000
@@ -16,7 +16,7 @@
                                           0xb6, 0x1d, 0xf6, 0x56, 0xa5, 0xef, 
0xfc, 0xe2}};
 static aes_ctx ctx[2];
 
-void aeshash_type(const unsigned char in[], unsigned char out[], int type)
+static void aeshash_type(const unsigned char in[], unsigned char out[], int 
type)
 {
     memset(out, 0, BLOCK_SIZE);
     aes_enc_blk(in, out, ctx + type);
@@ -34,7 +34,7 @@
     aeshash_type(in, out, r_c);
 }
 
-void aeshash_init_type(int type)
+static void aeshash_init_type(int type)
 {
     ctx[type].n_rnd = 0; // ensure all flags are initially set to zero
     ctx[type].n_blk = 0;

=== modified file 'i3/chord/gen_conf.c'
--- i3/chord/gen_conf.c 2010-02-17 17:38:08 +0000
+++ i3/chord/gen_conf.c 2010-04-13 16:29:54 +0000
@@ -28,7 +28,7 @@
 #define NEWS
 
 /* get_addr: get IP address of server */
-unsigned long get_addr1(char *name, int *ok_flag)
+static unsigned long get_addr1(char *name, int *ok_flag)
 {
     int i, tempfd, ret;
     struct sockaddr_in tmp_addr;

=== modified file 'i3/chord/util.c'
--- i3/chord/util.c     2010-04-13 10:46:05 +0000
+++ i3/chord/util.c     2010-04-13 16:29:54 +0000
@@ -190,7 +190,7 @@
 
 /**********************************************************************/
 
-chordID random_from(chordID *a)
+static chordID random_from(chordID *a)
 {
     chordID b;
     int i, m = random() % 10 + 1;

=== modified file 'i3/i3/i3_config.c'
--- i3/i3/i3_config.c   2010-03-29 17:50:59 +0000
+++ i3/i3/i3_config.c   2010-04-13 16:29:54 +0000
@@ -70,7 +70,7 @@
     //xmlCleanupParser();
 }
 
-xmlXPathObjectPtr getnodeset(xmlChar *xpath)
+static xmlXPathObjectPtr getnodeset(xmlChar *xpath)
 {
     xmlXPathContextPtr context;
     xmlXPathObjectPtr result;
@@ -88,7 +88,7 @@
     return result;
 }
 
-void strip_ws(char *str)
+static void strip_ws(char *str)
 {
     char tstr[200];
     int lindex = 0;

=== modified file 'i3/i3/i3_options.c'
--- i3/i3/i3_options.c  2010-03-29 17:50:59 +0000
+++ i3/i3/i3_options.c  2010-04-13 16:29:54 +0000
@@ -87,7 +87,7 @@
     }
 }
 
-i3_option *duplicate_i3_option(i3_option *option)
+static i3_option *duplicate_i3_option(i3_option *option)
 {
     i3_option *new_option = alloc_i3_option();
 

=== modified file 'i3/i3/i3_trigger.c'
--- i3/i3/i3_trigger.c  2010-03-29 17:50:59 +0000
+++ i3/i3/i3_trigger.c  2010-04-13 16:29:54 +0000
@@ -460,7 +460,7 @@
     aeshash_r(lkey->x, rkey->x);
 }
 
-void generate_l_constraint(i3_trigger *t, Key *key)
+static void generate_l_constraint(i3_trigger *t, Key *key)
 {
     if (I3_ADDR_TYPE_STACK == t->to->type) {
         generate_l_constraint_id(t->to->t.stack->ids, key);
@@ -471,7 +471,7 @@
     }
 }
 
-int is_constrained(ID *id, Key *key)
+static int is_constrained(ID *id, Key *key)
 {
     int retval;
     retval = (0 == memcmp(KEY_ID_PTR(id), key->x, KEY_LEN));

=== modified file 'i3/i3_client/coordinates.c'
--- i3/i3_client/coordinates.c  2010-02-17 17:38:08 +0000
+++ i3/i3_client/coordinates.c  2010-04-13 16:29:54 +0000
@@ -13,7 +13,7 @@
 static Coordinates my_coordinates;
 
 /* function to minimize */
-float objective_function(float dim[], int ndim)
+static float objective_function(float dim[], int ndim)
 {
     int i;
     float sum        = 0;

=== modified file 'i3/i3_client/http.c'
--- i3/i3_client/http.c 2010-04-13 16:22:26 +0000
+++ i3/i3_client/http.c 2010-04-13 16:29:54 +0000
@@ -48,8 +48,8 @@
  *   input: www.cs.berkeley.edu/~istoica/index.html
  *   host:  www.cs.berkeley.edu
  *   get_cmd: GET /~istoica/index.html HTTP/1.0 */
-void get_args(char *input, char *host, char *get_cmd,
-              int *port, int buf_len)
+static void get_args(char *input, char *host, char *get_cmd,
+                     int *port, int buf_len)
 {
     char *p1, *p2, *end, *ptemp;
 
@@ -97,8 +97,8 @@
 }
 
 /* get an entry containing the host IP address, port number, and 20 byte ID */
-int get_entry(char *buf, char *end, char *ip_addr, int *port,
-              char *id, char *status, float *latitude, float *longitude)
+static int get_entry(char *buf, char *end, char *ip_addr, int *port,
+                     char *id, char *status, float *latitude, float *longitude)
 {
     char *ip_start, *port_start, *id_start, *status_start, *coord_start, 
*temp, *p1, *p2;
     char num_str[PORT_LEN];
@@ -194,7 +194,7 @@
     return 0;
 }
 
-int get_address(char *web_url, I3ServerList *list)
+static int get_address(char *web_url, I3ServerList *list)
 {
     nw_skt_t sockid;
     int bufsize;

=== modified file 'i3/i3_client/i3_client_callback.c'
--- i3/i3_client/i3_client_callback.c   2010-02-17 17:38:08 +0000
+++ i3/i3_client/i3_client_callback.c   2010-04-13 16:29:54 +0000
@@ -21,7 +21,7 @@
 #endif
 
 
-void printf_def_cbk(char *str, ID *id, int intend)
+static void printf_def_cbk(char *str, ID *id, int intend)
 {
 #ifdef PRINT_DEF_CBK
     I3_PRINT_DEBUG1(DEBUG_LEVEL_MINIMAL, "Default callback: %s\n", str);

=== modified file 'i3/i3_client/i3_client_context.c'
--- i3/i3_client/i3_client_context.c    2010-03-29 17:50:59 +0000
+++ i3/i3_client/i3_client_context.c    2010-04-13 16:29:54 +0000
@@ -49,7 +49,7 @@
 
 int does_id_match(ID *id1, ID *id2, int prefix_len);
 
-void close_tcp(cl_context *ctx)
+static void close_tcp(cl_context *ctx)
 {
     printf("\nClosing fd = %d\n", ctx->tcp_fd);
     nw_close(ctx->tcp_fd);
@@ -314,7 +314,7 @@
 }
 
 /* close sockets and re-open them */
-void cl_reinit_context(cl_context *ctx)
+static void cl_reinit_context(cl_context *ctx)
 {
     static int so_reuseaddr = 1;
     uint8_t opt_mask;

=== modified file 'i3/i3_client/i3_client_trigger.c'
--- i3/i3_client/i3_client_trigger.c    2010-03-29 17:50:59 +0000
+++ i3/i3_client/i3_client_trigger.c    2010-04-13 16:29:54 +0000
@@ -290,7 +290,7 @@
 }
 
 /* get the common prefix length of x and y */
-int num_matched_bits(ID *id1, ID *id2)
+static int num_matched_bits(ID *id1, ID *id2)
 {
     int i, j;
     char mask = 0x80;

=== modified file 'i3/i3_client/i3server_list.c'
--- i3/i3_client/i3server_list.c        2010-03-09 15:41:40 +0000
+++ i3/i3_client/i3server_list.c        2010-04-13 16:29:54 +0000
@@ -25,7 +25,7 @@
 HANDLE i3server_list_mutex          = NULL;
 #endif
 
-int i3server_list_lock(void)
+static int i3server_list_lock(void)
 {
 #ifndef _WIN32
     if (pthread_mutex_lock(&i3server_list_mutex)) {
@@ -38,7 +38,7 @@
     return 0;
 }
 
-int i3server_list_unlock(void)
+static int i3server_list_unlock(void)
 {
 #ifndef _WIN32
     if (pthread_mutex_unlock(&i3server_list_mutex)) {
@@ -74,8 +74,9 @@
 /***************************************************************************
  * Purpose: To initialize an i3server node structure
  **************************************************************************/
-I3ServerListNode *init_i3server_node(uint32_t addr,
-                                     uint16_t port, ID id, Coordinates coord)
+static I3ServerListNode *init_i3server_node(uint32_t addr,
+                                            uint16_t port, ID id,
+                                            Coordinates coord)
 {
     I3ServerListNode *node;
     uint32_t h;
@@ -209,7 +210,7 @@
 /***************************************************************************
  * Purpose: To update ping list with a node
  **************************************************************************/
-void add_to_ping_list(I3ServerList *list, I3ServerListNode *node)
+static void add_to_ping_list(I3ServerList *list, I3ServerListNode *node)
 {
     uint32_t h = i3server_hash(node->addr, I3SERVERHASH);
 
@@ -446,8 +447,9 @@
 /***************************************************************************
  * Purpose: Sort ping-list based on  rtt
  **************************************************************************/
-int sort_ping_list(I3ServerList *list,
-                   I3ServerListNode *sorted_list[], uint64_t sorted_rtt[])
+static int sort_ping_list(I3ServerList *list,
+                          I3ServerListNode *sorted_list[],
+                          uint64_t sorted_rtt[])
 {
     I3ServerListNode *curr;
     int num = 0, i, j;
@@ -479,8 +481,8 @@
 /***************************************************************************
  * Purpose: Sort full-list based on coordinates
  **************************************************************************/
-int sort_coord(I3ServerList *list, I3ServerListNode *sorted_list[],
-               float sorted_rtt[])
+static int sort_coord(I3ServerList *list, I3ServerListNode *sorted_list[],
+                      float sorted_rtt[])
 {
     I3ServerListNode *curr;
     int num = 0, i, j;
@@ -571,7 +573,7 @@
     return num;
 }
 
-int is_between(ID *middle, ID *start, ID *end)
+static int is_between(ID *middle, ID *start, ID *end)
 {
     int a = compare_ids(start, middle);
     int b = compare_ids(middle, end);
@@ -630,7 +632,7 @@
 /***************************************************************************
  * Purpose: Remove low-performance i3 servers from list. Limit size to top-K
  **************************************************************************/
-void remove_bad_servers_ping_list(I3ServerList *list, int num_remove)
+static void remove_bad_servers_ping_list(I3ServerList *list, int num_remove)
 {
     I3ServerListNode *sorted_list[MAX_PING_LIST_SIZE], *prev, *curr;
     uint64_t sorted_rtt[MAX_PING_LIST_SIZE];
@@ -683,7 +685,8 @@
  * Fill up the ping list
  *   - closeness based on euclidean dist over the coordinate space
  *****************************************************************/
-void fill_up_ping_list_closest(I3ServerList *list, I3ServerListNode 
**next_ping)
+static void fill_up_ping_list_closest(I3ServerList *list,
+                                      I3ServerListNode **next_ping)
 {
     int i, num, num_added;
 
@@ -747,7 +750,8 @@
  * Fill up the ping list
  *   - closeness based on euclidean dist over the coordinate space
  *****************************************************************/
-void fill_up_ping_list_random(I3ServerList *list, I3ServerListNode **next_ping)
+static void fill_up_ping_list_random(I3ServerList *list,
+                                     I3ServerListNode **next_ping)
 {
     int i, r, num, num_added;
     I3ServerListNode *node = NULL, *prev = NULL;

=== modified file 'i3/i3_client/ping_thread.c'
--- i3/i3_client/ping_thread.c  2010-03-29 17:50:59 +0000
+++ i3/i3_client/ping_thread.c  2010-04-13 16:29:54 +0000
@@ -46,7 +46,7 @@
 HANDLE status_mutex          = NULL;
 #endif
 
-int status_lock(void)
+static int status_lock(void)
 {
 #ifndef _WIN32
     if (pthread_mutex_lock(&status_mutex)) {
@@ -59,7 +59,7 @@
     return 0;
 }
 
-int status_unlock(void)
+static int status_unlock(void)
 {
 #ifndef _WIN32
     if (pthread_mutex_unlock(&status_mutex)) {
@@ -90,7 +90,7 @@
     status_unlock();
 }
 
-char get_status(uint64_t *ping_start_time, uint64_t curr_time)
+static char get_status(uint64_t *ping_start_time, uint64_t curr_time)
 {
     char ret = PING_STATUS_STEADY;
     status_lock();
@@ -104,7 +104,8 @@
 }
 
 /* Send a set of pings to nodes in order */
-void send_npings(nw_skt_t sock, I3ServerList *list, I3ServerListNode **node, 
int n)
+static void send_npings(nw_skt_t sock, I3ServerList *list,
+                        I3ServerListNode **node, int n)
 {
     int i;
     static int seq = 1;
@@ -136,7 +137,7 @@
 
 /* To determine the coordinates of the local node initially
  * Ping a subset of nodes and determine coordinates */
-void init_coordinates(I3ServerList *list)
+static void init_coordinates(I3ServerList *list)
 {
     int n                  = MIN(NUM_LANDMARKS_COORDINATE, 
list->num_newservers + list->num_ping_list);
     I3ServerListNode *node = list->list, *temp_node;

=== modified file 'i3/utils/event.c'
--- i3/utils/event.c    2010-03-29 16:47:25 +0000
+++ i3/utils/event.c    2010-04-13 16:29:54 +0000
@@ -58,7 +58,7 @@
 }
 
 // swap two events in the heap
-void swap_events(EventHeap *h, unsigned int idx, unsigned int idx1)
+static void swap_events(EventHeap *h, unsigned int idx, unsigned int idx1)
 {
     Event *t;
 

=== modified file 'i3/utils/inetfns.c'
--- i3/utils/inetfns.c  2010-04-13 09:52:59 +0000
+++ i3/utils/inetfns.c  2010-04-13 16:29:54 +0000
@@ -72,7 +72,7 @@
  * Return: As an unsigned long in network byte order
  *
  **************************************************************************/
-uint32_t name_to_addr(const char *name)
+static uint32_t name_to_addr(const char *name)
 {
     int i;
     struct hostent *hptr = gethostbyname(name);
@@ -96,7 +96,7 @@
  * Return: As an unsigned long in network byte order
  *
  **************************************************************************/
-uint32_t get_local_addr_uname(void)
+static uint32_t get_local_addr_uname(void)
 {
     struct utsname myname;
     uint32_t addr = 0;
@@ -123,7 +123,7 @@
  * Return: As an unsigned long in network byte order
  *
  **************************************************************************/
-uint32_t get_local_addr_by_interface(char *interfaceName)
+static uint32_t get_local_addr_by_interface(char *interfaceName)
 {
     int i, tempfd;
     struct sockaddr_in addr;
@@ -210,7 +210,7 @@
  * Return: As an unsigned long in network byte order
  *
  **************************************************************************/
-uint32_t get_local_addr(void)
+static uint32_t get_local_addr(void)
 {
     uint32_t addr;
 
@@ -241,7 +241,7 @@
     return get_local_addr();
 }
 
-uint32_t name_to_addr(const char *name)
+static uint32_t name_to_addr(const char *name)
 {
     uint32_t ret_val     = 0;
     int err              = 0;
@@ -279,7 +279,7 @@
     }
 }
 
-uint32_t get_local_addr_uname(void)
+static uint32_t get_local_addr_uname(void)
 {
     char *buf;
     int buf_size = 1024;
@@ -300,7 +300,7 @@
 }
 
 #if 0
-uint32_t get_local_addr(void)
+static uint32_t get_local_addr(void)
 {
     // - retrieve information about all network adapters
     // - look for the first non-loopback interface

Other related posts:

  • » [hipl-commit] [trunk] Rev 4266: i3: Mark all functions only used within their files as static. - Diego Biurrun