aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-08-16 20:46:00 +0000
committerNick Mathewson <nickm@torproject.org>2004-08-16 20:46:00 +0000
commit15a903b21ce93800d5f3867bcb1eccfc349e653f (patch)
tree539bec05eef2499cae949f23f2a2d0e3d3ae3a45 /src/common/util.c
parentbec9a6eb7df92e5d363c3e20a17a2a67c9fbedc1 (diff)
downloadtor-15a903b21ce93800d5f3867bcb1eccfc349e653f.tar
tor-15a903b21ce93800d5f3867bcb1eccfc349e653f.tar.gz
Convenience function to do a strcmp on each member of a smartlist of strings
svn:r2243
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 50010bcb4..68d858e82 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -360,6 +360,14 @@ int smartlist_isin(const smartlist_t *sl, void *element) {
return 0;
}
+int smartlist_string_isin(const smartlist_t *sl, const char *element) {
+ int i;
+ for(i=0; i < sl->num_used; i++)
+ if(strcmp((const char*)sl->list[i],element)==0)
+ return 1;
+ return 0;
+}
+
/** Return true iff some element E of sl2 has smartlist_isin(sl1,E).
*/
int smartlist_overlap(const smartlist_t *sl1, const smartlist_t *sl2) {