mirror of
https://github.com/linux-sunxi/sunxi-tools.git
synced 2024-11-23 01:46:44 +08:00
fexc: script: add script_find_entry() helper
This commit is contained in:
parent
d08be28bfa
commit
a9b9991630
20
script.c
20
script.c
@ -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(§ion->entries); o;
|
||||
o = list_next(§ion->entries, o)) {
|
||||
ep = container_of(o, struct script_entry, entries);
|
||||
|
||||
if (strcmp(ep->name, name) == 0)
|
||||
return ep;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
5
script.h
5
script.h
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user