aboutsummaryrefslogtreecommitdiff
path: root/src/common/container.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-12-28 21:29:03 +0000
committerNick Mathewson <nickm@torproject.org>2006-12-28 21:29:03 +0000
commit4cd302a1ebd44eafe5ac57062288436ab41b1220 (patch)
tree67d580a3df417b0a0878482fdb02c5b344874500 /src/common/container.c
parente631b0a56f8958d104d3c74fa4b17dfbfacd6d6e (diff)
downloadtor-4cd302a1ebd44eafe5ac57062288436ab41b1220.tar.gz
tor-4cd302a1ebd44eafe5ac57062288436ab41b1220.zip
r11722@Kushana: nickm | 2006-12-28 13:51:42 -0500
Add a helper function for case-insensitive search through a smartlist svn:r9198
Diffstat (limited to 'src/common/container.c')
-rw-r--r--src/common/container.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/common/container.c b/src/common/container.c
index 6dae0bb932..659e1346d1 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -197,6 +197,20 @@ smartlist_string_isin(const smartlist_t *sl, const char *element)
return 0;
}
+/** Return true iff <b>sl</b> has some element E such that
+ * !strcasecmp(E,<b>element</b>)
+ */
+int
+smartlist_string_isin_case(const smartlist_t *sl, const char *element)
+{
+ int i;
+ if (!sl) return 0;
+ for (i=0; i < sl->num_used; i++)
+ if (strcasecmp((const char*)sl->list[i],element)==0)
+ return 1;
+ return 0;
+}
+
/** Return true iff <b>sl</b> has some element E such that E is equal
* to the decimal encoding of <b>num</b>.
*/