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

script: add script_find_section() helper

parent 1f505627
......@@ -90,6 +90,26 @@ void script_section_delete(struct script_section *section)
list_remove(&section->sections);
}
struct script_section *script_find_section(struct script *script,
const char *name)
{
struct list_entry *o;
struct script_section *section;
assert(script);
assert(name);
for (o = list_first(&script->sections); o;
o = list_next(&script->sections, o)) {
section = container_of(o, struct script_section, sections);
if (strcmp(section->name, name) == 0)
return section;
}
return NULL;
}
/*
*/
static inline void script_entry_append(struct script_section *section,
......
......@@ -86,6 +86,10 @@ struct script_section *script_section_new(struct script *script,
/** deletes a section recursvely and removes it from the script */
void script_section_delete(struct script_section *section);
/** find existing section */
struct script_section *script_find_section(struct script *section,
const char *name);
/** deletes an entry and removes it from the section */
void script_entry_delete(struct script_entry *entry);
......
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