[or-cvs] Make some functions static

Nick Mathewson nickm at seul.org
Wed May 12 20:58:29 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv30489/src/or

Modified Files:
	circuit.c connection.c cpuworker.c dns.c or.h rendclient.c 
	rendcommon.c 
Log Message:
Make some functions static

Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.233
retrieving revision 1.234
diff -u -d -r1.233 -r1.234
--- circuit.c	12 May 2004 19:49:48 -0000	1.233
+++ circuit.c	12 May 2004 20:58:27 -0000	1.234
@@ -22,6 +22,8 @@
 static void circuit_is_open(circuit_t *circ);
 static void circuit_build_failed(circuit_t *circ);
 static circuit_t *circuit_establish_circuit(uint8_t purpose, const char *exit_nickname);
+static void circuit_free(circuit_t *circ);
+static void circuit_free_cpath(crypt_path_t *cpath);
 
 /********* START VARIABLES **********/
 
@@ -112,7 +114,7 @@
 
 /** Deallocate space associated with circ.
  */
-void circuit_free(circuit_t *circ) {
+static void circuit_free(circuit_t *circ) {
   tor_assert(circ);
   tor_assert(circ->magic == CIRCUIT_MAGIC);
   if (circ->n_crypto)
@@ -139,7 +141,7 @@
 }
 
 /** Deallocate space associated with the linked list <b>cpath</b>. */
-void circuit_free_cpath(crypt_path_t *cpath) {
+static void circuit_free_cpath(crypt_path_t *cpath) {
   crypt_path_t *victim, *head=cpath;
 
   if(!cpath)

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.221
retrieving revision 1.222
diff -u -d -r1.221 -r1.222
--- connection.c	12 May 2004 20:36:44 -0000	1.221
+++ connection.c	12 May 2004 20:58:27 -0000	1.222
@@ -79,6 +79,8 @@
 static int connection_receiver_bucket_should_increase(connection_t *conn);
 static int connection_finished_flushing(connection_t *conn);
 static int connection_finished_connecting(connection_t *conn);
+static int connection_read_to_buf(connection_t *conn);
+static int connection_process_inbuf(connection_t *conn);
 
 /**************************************************************/
 
@@ -702,7 +704,7 @@
  *
  * Return -1 if we want to break conn, else return 0.
  */
-int connection_read_to_buf(connection_t *conn) {
+static int connection_read_to_buf(connection_t *conn) {
   int result;
   int at_most;
 
@@ -1103,7 +1105,7 @@
  * This function just passes conn to the connection-specific
  * connection_*_process_inbuf() function.
  */
-int connection_process_inbuf(connection_t *conn) {
+static int connection_process_inbuf(connection_t *conn) {
 
   tor_assert(conn);
 

Index: cpuworker.c
===================================================================
RCS file: /home/or/cvsroot/src/or/cpuworker.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- cpuworker.c	10 May 2004 10:27:54 -0000	1.39
+++ cpuworker.c	12 May 2004 20:58:27 -0000	1.40
@@ -34,7 +34,7 @@
  * the last time we got a key rotation event. */
 static time_t last_rotation_time=0;
 
-int cpuworker_main(void *data);
+static int cpuworker_main(void *data);
 static int spawn_cpuworker(void);
 static void spawn_enough_cpuworkers(void);
 static void process_pending_task(connection_t *cpuworker);
@@ -183,7 +183,7 @@
  *          Onionskin challenge ONIONSKIN_REPLY_LEN
  *          Negotiated keys     KEY_LEN*2+DIGEST_LEN*2
  */
-int cpuworker_main(void *data) {
+static int cpuworker_main(void *data) {
   unsigned char question[ONIONSKIN_CHALLENGE_LEN];
   unsigned char question_type;
   int *fdarray = data;

Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dns.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- dns.c	10 May 2004 10:27:54 -0000	1.91
+++ dns.c	12 May 2004 20:58:27 -0000	1.92
@@ -66,7 +66,7 @@
 static int assign_to_dnsworker(connection_t *exitconn);
 static void dns_purge_resolve(struct cached_resolve *resolve);
 static void dns_found_answer(char *address, uint32_t addr, char outcome);
-int dnsworker_main(void *data);
+static int dnsworker_main(void *data);
 static int spawn_dnsworker(void);
 static void spawn_enough_dnsworkers(void);
 
@@ -532,7 +532,7 @@
  * The dnsworker runs indefinitely, until its connection is closed or an error
  * occurs.
  */
-int dnsworker_main(void *data) {
+static int dnsworker_main(void *data) {
   char address[MAX_ADDRESSLEN];
   unsigned char address_len;
   char answer[5];

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.343
retrieving revision 1.344
diff -u -d -r1.343 -r1.344
--- or.h	12 May 2004 20:36:44 -0000	1.343
+++ or.h	12 May 2004 20:58:27 -0000	1.344
@@ -867,7 +867,6 @@
 extern char *circuit_state_to_string[];
 circuit_t *circuit_new(uint16_t p_circ_id, connection_t *p_conn);
 void circuit_close_all_marked(void);
-void circuit_free(circuit_t *circ);
 void circuit_free_cpath(crypt_path_t *cpath);
 int _circuit_mark_for_close(circuit_t *circ);
 
@@ -980,7 +979,6 @@
 void connection_bucket_refill(struct timeval *now);
 
 int connection_handle_read(connection_t *conn);
-int connection_read_to_buf(connection_t *conn);
 
 int connection_fetch_from_buf(char *string, int len, connection_t *conn);
 
@@ -1008,8 +1006,6 @@
 
 int connection_send_destroy(uint16_t circ_id, connection_t *conn);
 
-int connection_process_inbuf(connection_t *conn);
-
 void assert_connection_ok(connection_t *conn, time_t now);
 
 /********************************* connection_edge.c ***************************/
@@ -1071,7 +1067,6 @@
 void cpuworkers_rotate(void);
 int connection_cpu_finished_flushing(connection_t *conn);
 int connection_cpu_process_inbuf(connection_t *conn);
-int cpuworker_main(void *data);
 int assign_to_cpuworker(connection_t *cpuworker, unsigned char question_type,
                         void *task);
 
@@ -1195,7 +1190,6 @@
 int rend_client_receive_rendezvous(circuit_t *circ, const char *request, int request_len);
 void rend_client_desc_fetched(char *query, int success);
 
-int rend_cmp_service_ids(const char *one, const char *two);
 char *rend_client_get_random_intro(char *query);
 int rend_parse_rendezvous_address(char *address);
 
@@ -1211,6 +1205,8 @@
   char **intro_points;
 } rend_service_descriptor_t;
 
+int rend_cmp_service_ids(const char *one, const char *two);
+
 void rend_process_relay_cell(circuit_t *circ, int command, int length,
                              const char *payload);
 

Index: rendclient.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendclient.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- rendclient.c	10 May 2004 04:34:48 -0000	1.48
+++ rendclient.c	12 May 2004 20:58:27 -0000	1.49
@@ -24,7 +24,7 @@
 /** Send the establish-rendezvous cell along a rendezvous circuit. if
  * it fails, mark the circ for close and return -1. else return 0.
  */
-int
+static int
 rend_client_send_establish_rendezvous(circuit_t *circ)
 {
   tor_assert(circ->purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND);
@@ -389,11 +389,6 @@
   }
 }
 
-/** Return 0 if one and two are the same service ids, else -1 or 1 */
-int rend_cmp_service_ids(const char *one, const char *two) {
-  return strcasecmp(one,two);
-}
-
 /** strdup a nickname for a random introduction
  * point of query. return NULL if error.
  */

Index: rendcommon.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendcommon.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- rendcommon.c	10 May 2004 04:34:48 -0000	1.31
+++ rendcommon.c	12 May 2004 20:58:27 -0000	1.32
@@ -10,6 +10,12 @@
 
 #include "or.h"
 
+
+/** Return 0 if one and two are the same service ids, else -1 or 1 */
+int rend_cmp_service_ids(const char *one, const char *two) {
+  return strcasecmp(one,two);
+}
+
 /** Free the storage held by the service descriptor <b>desc</b>.
  */
 void rend_service_descriptor_free(rend_service_descriptor_t *desc)



More information about the tor-commits mailing list