[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Don"t use Tor version 0.0.5 for intro/rendezvous points. (...



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

Modified Files:
	util.c util.h 
Log Message:
Don't use Tor version 0.0.5 for intro/rendezvous points.  (We don't need
to worry about 0.0.4 or earlier, because nobody is running them any more.)


Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- util.c	7 Apr 2004 19:57:39 -0000	1.83
+++ util.c	7 Apr 2004 21:36:03 -0000	1.84
@@ -213,7 +213,13 @@
   sl->num_used = 0;
 }
 
-/* add element to the list, but only if there's room */
+void smartlist_truncate(smartlist_t *sl, int len)
+{
+  assert(len <= sl->num_used);
+  sl->num_used = len;
+}
+
+/* add element to the list */
 void smartlist_add(smartlist_t *sl, void *element) {
   if (sl->num_used >= sl->capacity) {
     sl->capacity *= 2;
@@ -222,6 +228,12 @@
   sl->list[sl->num_used++] = element;
 }
 
+/* Add all elements from S2 to S1. */
+void smartlist_add_all(smartlist_t *sl, const smartlist_t *s2)
+{
+  SMARTLIST_FOREACH(s2, void *, element, smartlist_add(sl, element));
+}
+
 void smartlist_remove(smartlist_t *sl, void *element) {
   int i;
   if(element == NULL)
@@ -233,7 +245,7 @@
     }
 }
 
-int smartlist_isin(smartlist_t *sl, void *element) {
+int smartlist_isin(const smartlist_t *sl, void *element) {
   int i;
   for(i=0; i < sl->num_used; i++)
     if(sl->list[i] == element)
@@ -241,7 +253,7 @@
   return 0;
 }
 
-int smartlist_overlap(smartlist_t *sl1, smartlist_t *sl2) {
+int smartlist_overlap(const smartlist_t *sl1, const smartlist_t *sl2) {
   int i;
   for(i=0; i < sl2->num_used; i++)
     if(smartlist_isin(sl1, sl2->list[i]))
@@ -250,7 +262,7 @@
 }
 
 /* remove elements of sl1 that aren't in sl2 */
-void smartlist_intersect(smartlist_t *sl1, smartlist_t *sl2) {
+void smartlist_intersect(smartlist_t *sl1, const smartlist_t *sl2) {
   int i;
   for(i=0; i < sl1->num_used; i++)
     if(!smartlist_isin(sl2, sl1->list[i])) {
@@ -260,19 +272,19 @@
 }
 
 /* remove all elements of sl2 from sl1 */
-void smartlist_subtract(smartlist_t *sl1, smartlist_t *sl2) {
+void smartlist_subtract(smartlist_t *sl1, const smartlist_t *sl2) {
   int i;
   for(i=0; i < sl2->num_used; i++)
     smartlist_remove(sl1, sl2->list[i]);
 }
 
-void *smartlist_choose(smartlist_t *sl) {
+void *smartlist_choose(const smartlist_t *sl) {
   if(sl->num_used)
     return sl->list[crypto_pseudo_rand_int(sl->num_used)];
   return NULL; /* no elements to choose from */
 }
 
-void *smartlist_get(smartlist_t *sl, int idx)
+void *smartlist_get(const smartlist_t *sl, int idx)
 {
   assert(sl && idx>=0 && idx < sl->num_used);
   return sl->list[idx];
@@ -303,7 +315,7 @@
     memmove(sl->list+idx, sl->list+idx+1, sizeof(void*)*(sl->num_used-idx));
   return old;
 }
-int smartlist_len(smartlist_t *sl)
+int smartlist_len(const smartlist_t *sl)
 {
   return sl->num_used;
 }

Index: util.h
===================================================================
RCS file: /home/or/cvsroot/src/common/util.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- util.h	7 Apr 2004 19:46:26 -0000	1.54
+++ util.h	7 Apr 2004 21:36:03 -0000	1.55
@@ -103,19 +103,21 @@
 void smartlist_free(smartlist_t *sl);
 void smartlist_set_capacity(smartlist_t *sl, int n);
 void smartlist_clear(smartlist_t *sl);
+void smartlist_truncate(smartlist_t *sl, int n);
 void smartlist_add(smartlist_t *sl, void *element);
+void smartlist_add_all(smartlist_t *sl, const smartlist_t *s2);
 void smartlist_remove(smartlist_t *sl, void *element);
-int smartlist_isin(smartlist_t *sl, void *element);
-int smartlist_overlap(smartlist_t *sl1, smartlist_t *sl2);
-void smartlist_intersect(smartlist_t *sl1, smartlist_t *sl2);
-void smartlist_subtract(smartlist_t *sl1, smartlist_t *sl2);
-void *smartlist_choose(smartlist_t *sl);
-void *smartlist_get(smartlist_t *sl, int idx);
+int smartlist_isin(const smartlist_t *sl, void *element);
+int smartlist_overlap(const smartlist_t *sl1, const smartlist_t *sl2);
+void smartlist_intersect(smartlist_t *sl1, const smartlist_t *sl2);
+void smartlist_subtract(smartlist_t *sl1, const smartlist_t *sl2);
+void *smartlist_choose(const smartlist_t *sl);
+void *smartlist_get(const smartlist_t *sl, int idx);
 void *smartlist_set(smartlist_t *sl, int idx, void *val);
 void *smartlist_del(smartlist_t *sl, int idx);
 void *smartlist_del_keeporder(smartlist_t *sl, int idx);
 void smartlist_insert(smartlist_t *sl, int idx, void *val);
-int smartlist_len(smartlist_t *sl);
+int smartlist_len(const smartlist_t *sl);
 #define SMARTLIST_FOREACH(sl, type, var, cmd)                   \
   do {                                                          \
     int sl_idx, sl_len=smartlist_len(sl);                       \