summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/container.c12
-rw-r--r--src/common/container.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/common/container.c b/src/common/container.c
index a3663c48f6..9333ccdb16 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -196,6 +196,18 @@ smartlist_string_isin(const smartlist_t *sl, const char *element)
return 0;
}
+/** DOCDOC */
+int
+smartlist_string_pos(const smartlist_t *sl, const char *element)
+{
+ int i;
+ if (!sl) return -1;
+ for (i=0; i < sl->num_used; i++)
+ if (strcmp((const char*)sl->list[i],element)==0)
+ return i;
+ return -1;
+}
+
/** Return true iff <b>sl</b> has some element E such that
* !strcasecmp(E,<b>element</b>)
*/
diff --git a/src/common/container.h b/src/common/container.h
index 735965358a..782c4a491f 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -40,6 +40,7 @@ void smartlist_string_remove(smartlist_t *sl, const char *element);
int smartlist_isin(const smartlist_t *sl, const void *element) ATTR_PURE;
int smartlist_string_isin(const smartlist_t *sl, const char *element)
ATTR_PURE;
+int smartlist_string_pos(const smartlist_t *, const char *elt) ATTR_PURE;
int smartlist_string_isin_case(const smartlist_t *sl, const char *element)
ATTR_PURE;
int smartlist_string_num_isin(const smartlist_t *sl, int num) ATTR_PURE;