Commit a9b99916 authored by Alejandro Mery's avatar Alejandro Mery
Browse files

fexc: script: add script_find_entry() helper

parent d08be28b
...@@ -246,3 +246,23 @@ struct script_gpio_entry *script_gpio_entry_new(struct script_section *section, ...@@ -246,3 +246,23 @@ struct script_gpio_entry *script_gpio_entry_new(struct script_section *section,
return entry; return entry;
} }
struct script_entry *script_find_entry(struct script_section *section,
const char *name)
{
struct list_entry *o;
struct script_entry *ep;
assert(section);
assert(name);
for (o = list_first(&section->entries); o;
o = list_next(&section->entries, o)) {
ep = container_of(o, struct script_entry, entries);
if (strcmp(ep->name, name) == 0)
return ep;
}
return NULL;
}
...@@ -87,7 +87,7 @@ struct script_section *script_section_new(struct script *script, ...@@ -87,7 +87,7 @@ struct script_section *script_section_new(struct script *script,
void script_section_delete(struct script_section *section); void script_section_delete(struct script_section *section);
/** find existing section */ /** find existing section */
struct script_section *script_find_section(struct script *section, struct script_section *script_find_section(struct script *script,
const char *name); const char *name);
/** deletes an entry and removes it from the section */ /** deletes an entry and removes it from the section */
...@@ -110,4 +110,7 @@ struct script_gpio_entry *script_gpio_entry_new(struct script_section *script, ...@@ -110,4 +110,7 @@ struct script_gpio_entry *script_gpio_entry_new(struct script_section *script,
unsigned port, unsigned num, unsigned port, unsigned num,
int32_t data[4]); int32_t data[4]);
/** find existing entry in a giving section */
struct script_entry *script_find_entry(struct script_section *section,
const char *name);
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment