From dc8c2c4b942f499fedb284b096eff3b2b9970b9c Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 27 Sep 2017 12:21:51 +0200 Subject: file_list: Add function to get entry by its name Signed-off-by: Sascha Hauer --- common/file-list.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'common/file-list.c') diff --git a/common/file-list.c b/common/file-list.c index 010f8f0617..0b760c1aec 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) { -- cgit v1.2.3