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>
diff --git a/common/env_attr.c b/common/env_attr.c
index 6e13184..b9de16f 100644
--- a/common/env_attr.c
+++ b/common/env_attr.c
@@ -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 @@
if (strlen(name) != 0) {
int retval = 0;
- retval = callback(name, attributes);
+ retval = callback(name, attributes, priv);
if (retval) {
free(entry_cpy);
return retval;