[or-cvs] r13596: Chris Palmer notes that almost nobody is using smartlist_set (in tor/trunk: . src/common src/or)

nickm at seul.org nickm at seul.org
Tue Feb 19 23:05:56 UTC 2008


Author: nickm
Date: 2008-02-19 18:05:56 -0500 (Tue, 19 Feb 2008)
New Revision: 13596

Modified:
   tor/trunk/
   tor/trunk/src/common/container.c
   tor/trunk/src/common/container.h
   tor/trunk/src/or/rendservice.c
Log:
 r18228 at catbus:  nickm | 2008-02-19 18:05:53 -0500
 Chris Palmer notes that almost nobody is using smartlist_set_capacity().  Chris Palmer is right.  Remove this basically pointless function.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r18228] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/common/container.c
===================================================================
--- tor/trunk/src/common/container.c	2008-02-19 23:01:07 UTC (rev 13595)
+++ tor/trunk/src/common/container.c	2008-02-19 23:05:56 UTC (rev 13596)
@@ -55,25 +55,6 @@
   tor_free(sl);
 }
 
-/** Change the capacity of the smartlist to <b>n</b>, so that we can grow
- * the list up to <b>n</b> elements with no further reallocation or wasted
- * space.  If <b>n</b> is less than or equal to the number of elements
- * currently in the list, reduce the list's capacity as much as
- * possible without losing elements.
- */
-void
-smartlist_set_capacity(smartlist_t *sl, int n)
-{
-  if (n < sl->num_used)
-    n = sl->num_used;
-  if (n < 1)
-    n = 1;
-  if (sl->capacity != n) {
-    sl->capacity = n;
-    sl->list = tor_realloc(sl->list, sizeof(void*)*sl->capacity);
-  }
-}
-
 /** Remove all elements from the list.
  */
 void

Modified: tor/trunk/src/common/container.h
===================================================================
--- tor/trunk/src/common/container.h	2008-02-19 23:01:07 UTC (rev 13595)
+++ tor/trunk/src/common/container.h	2008-02-19 23:05:56 UTC (rev 13596)
@@ -29,7 +29,6 @@
 
 smartlist_t *smartlist_create(void);
 void smartlist_free(smartlist_t *sl);
-void smartlist_set_capacity(smartlist_t *sl, int n);
 void smartlist_clear(smartlist_t *sl);
 void smartlist_add(smartlist_t *sl, void *element);
 void smartlist_add_all(smartlist_t *sl, const smartlist_t *s2);

Modified: tor/trunk/src/or/rendservice.c
===================================================================
--- tor/trunk/src/or/rendservice.c	2008-02-19 23:01:07 UTC (rev 13595)
+++ tor/trunk/src/or/rendservice.c	2008-02-19 23:05:56 UTC (rev 13596)
@@ -158,7 +158,6 @@
     log_warn(LD_CONFIG, "Hidden service with no ports configured; ignoring.");
     rend_service_free(service);
   } else {
-    smartlist_set_capacity(service->ports, -1);
     smartlist_add(rend_service_list, service);
     log_debug(LD_REND,"Configuring service with directory \"%s\"",
               service->directory);



More information about the tor-commits mailing list