summaryrefslogtreecommitdiffstats
path: root/common/file-list.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-09-27 12:21:51 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-09-27 14:02:20 +0200
commitdc8c2c4b942f499fedb284b096eff3b2b9970b9c (patch)
treef98c42a4bd13e8158af5ae7f77b9edb4f82ad89a /common/file-list.c
parent9f36f6d615ab6eca2e37823213c0f6f3ead25921 (diff)
downloadbarebox-dc8c2c4b942f499fedb284b096eff3b2b9970b9c.tar.gz
file_list: Add function to get entry by its name
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/file-list.c')
-rw-r--r--common/file-list.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/file-list.c b/common/file-list.c
index 010f8f0..0b760c1 100644
--- a/common/file-list.c
+++ b/common/file-list.c
@@ -8,6 +8,18 @@
#define PARSE_NAME 1
#define PARSE_FLAGS 2
+struct file_list_entry *file_list_entry_by_name(struct file_list *files, const char *name)
+{
+ struct file_list_entry *entry;
+
+ file_list_for_each_entry(files, entry) {
+ if (!strcmp(entry->name, name))
+ return entry;
+ }
+
+ return NULL;
+}
+
int file_list_add_entry(struct file_list *files, const char *name, const char *filename,
unsigned long flags)
{