[or-cvs] clean up smartlist_string_isin so callers don"t have to man...

Roger Dingledine arma at seul.org
Wed Jan 12 04:53:56 UTC 2005


Update of /home2/or/cvsroot/tor/src/common
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/common

Modified Files:
	container.c container.h 
Log Message:
clean up smartlist_string_isin so callers don't have to manage bufs
themselves


Index: container.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/common/container.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- container.c	16 Dec 2004 21:10:50 -0000	1.15
+++ container.c	12 Jan 2005 04:53:53 -0000	1.16
@@ -132,6 +132,12 @@
   return 0;
 }
 
+int smartlist_string_num_isin(const smartlist_t *sl, int num) {
+  char buf[16];
+  tor_snprintf(buf,sizeof(buf),"%d", num);
+  return smartlist_string_isin(sl, buf);
+}
+
 /** Return true iff some element E of sl2 has smartlist_isin(sl1,E).
  */
 int smartlist_overlap(const smartlist_t *sl1, const smartlist_t *sl2) {

Index: container.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/common/container.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- container.h	29 Nov 2004 22:25:28 -0000	1.9
+++ container.h	12 Jan 2005 04:53:53 -0000	1.10
@@ -31,6 +31,7 @@
 void smartlist_remove(smartlist_t *sl, void *element);
 int smartlist_isin(const smartlist_t *sl, void *element);
 int smartlist_string_isin(const smartlist_t *sl, const char *element);
+int smartlist_string_num_isin(const smartlist_t *sl, int num);
 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);



More information about the tor-commits mailing list