summaryrefslogtreecommitdiff
path: root/src/strv.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-06-16 05:06:02 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-16 05:06:02 +0200
commita4bfb3990be698b1f5c691a73823c040ffe919d5 (patch)
treef13640eb2fda183609f5680adf4068be786a25e1 /src/strv.c
parentd3782d60cd47f57f48a9229bdd3badbd2f4bae44 (diff)
strv: introduce strv_find_prefix()
Diffstat (limited to 'src/strv.c')
-rw-r--r--src/strv.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/strv.c b/src/strv.c
index a749096f9a..2ebd0ee53a 100644
--- a/src/strv.c
+++ b/src/strv.c
@@ -31,7 +31,6 @@
char *strv_find(char **l, const char *name) {
char **i;
- assert(l);
assert(name);
STRV_FOREACH(i, l)
@@ -41,6 +40,18 @@ char *strv_find(char **l, const char *name) {
return NULL;
}
+char *strv_find_prefix(char **l, const char *name) {
+ char **i;
+
+ assert(name);
+
+ STRV_FOREACH(i, l)
+ if (startswith(*i, name))
+ return *i;
+
+ return NULL;
+}
+
void strv_free(char **l) {
char **k;