Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
a9b99916
Commit
a9b99916
authored
Oct 01, 2012
by
Alejandro Mery
Browse files
fexc: script: add script_find_entry() helper
parent
d08be28b
Changes
2
Show whitespace changes
Inline
Side-by-side
script.c
View file @
a9b99916
...
@@ -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
;
}
script.h
View file @
a9b99916
...
@@ -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
*
s
ection
,
struct
script_section
*
script_find_section
(
struct
script
*
s
cript
,
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment