env: Allow env_attr_walk to pass a priv * to callback

In some cases it can be helpful to have context in the callback about
the calling situation. This is needed for following patches.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Joe Hershberger
2015-05-20 14:27:19 -05:00
committed by Tom Rini
parent 032ea185d6
commit cca98fd6aa
5 changed files with 20 additions and 17 deletions

View File

@@ -16,13 +16,14 @@
* attributes = [^,:\s]*
* entry = name[:attributes]
* list = entry[,list]
* It will call the "callback" function with the "name" and attribute as "value"
* It will call the "callback" function with the "name" and "attributes"
* The callback may return a non-0 to abort the list walk.
* This return value will be passed through to the caller.
* 0 is returned on success.
*/
extern int env_attr_walk(const char *attr_list,
int (*callback)(const char *name, const char *value));
int env_attr_walk(const char *attr_list,
int (*callback)(const char *name, const char *attributes, void *priv),
void *priv);
/*
* env_attr_lookup takes as input an "attr_list" with the same form as above.
@@ -33,7 +34,6 @@ extern int env_attr_walk(const char *attr_list,
* "attr_list" is NULL.
* Returns 0 on success.
*/
extern int env_attr_lookup(const char *attr_list, const char *name,
char *attributes);
int env_attr_lookup(const char *attr_list, const char *name, char *attributes);
#endif /* __ENV_ATTR_H__ */