summaryrefslogtreecommitdiff
path: root/src/common/container.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/container.c')
-rw-r--r--src/common/container.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/common/container.c b/src/common/container.c
index 33df51f5b3..f3077176cf 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -118,6 +118,21 @@ void smartlist_remove(smartlist_t *sl, void *element) {
}
}
+/** If there are any string in sl equal to element, remove the first.
+ * Does not preserve order. */
+void
+smartlist_string_remove(smartlist_t *sl, const char *element)
+{
+ int i;
+ size_t len = smartlist_len(sl);
+ for (i = 0; i < len; ++i) {
+ if (!strcmp(element, smartlist_get(sl, i))) {
+ smartlist_del(sl, i);
+ return;
+ }
+ }
+}
+
/** Return true iff some element E of sl has E==element.
*/
int smartlist_isin(const smartlist_t *sl, void *element) {