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:
committed by
Tom Rini
parent
032ea185d6
commit
cca98fd6aa
@@ -26,7 +26,8 @@
|
||||
* list = entry[,list]
|
||||
*/
|
||||
int env_attr_walk(const char *attr_list,
|
||||
int (*callback)(const char *name, const char *attributes))
|
||||
int (*callback)(const char *name, const char *attributes, void *priv),
|
||||
void *priv)
|
||||
{
|
||||
const char *entry, *entry_end;
|
||||
char *name, *attributes;
|
||||
@@ -93,7 +94,7 @@ int env_attr_walk(const char *attr_list,
|
||||
if (strlen(name) != 0) {
|
||||
int retval = 0;
|
||||
|
||||
retval = callback(name, attributes);
|
||||
retval = callback(name, attributes, priv);
|
||||
if (retval) {
|
||||
free(entry_cpy);
|
||||
return retval;
|
||||
|
||||
Reference in New Issue
Block a user