fexc: script: add script_find_entry() helper

This commit is contained in:
Alejandro Mery 2012-10-01 10:34:56 +02:00
parent d08be28bfa
commit a9b9991630
2 changed files with 24 additions and 1 deletions

View File

@ -246,3 +246,23 @@ struct script_gpio_entry *script_gpio_entry_new(struct script_section *section,
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;
}

View File

@ -87,7 +87,7 @@ struct script_section *script_section_new(struct script *script,
void script_section_delete(struct script_section *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);
/** 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,
unsigned port, unsigned num,
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