
Hi All,
On Tue, Apr 21, 2015 at 5:02 PM, Joe Hershberger joe.hershberger@ni.com wrote:
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
8<--snip-->8
diff --git a/common/env_attr.c b/common/env_attr.c index d266142..f0bf504 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 @@ 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;
@@ -120,8 +121,11 @@ static int reverse_name_search(const char *searched, const char *search_for, if (result) *result = NULL;
if (*search_for == '\0')
return (char *)searched;
if (*search_for == '\0') {
if (result)
*result = searched;
return strlen(searched);
}
I noticed shortly after sending this that this hunk belongs in the previous patch.
for (;;) { const char *match = strstr(cur_searched, search_for);
@@ -153,7 +157,8 @@ static int reverse_name_search(const char *searched, const char *search_for, *nextch != '\0') continue;
*result = match;
if (result)
*result = match;
As does this hunk.
result_size = strlen(search_for); }
8<--snip-->8
My apologies... I'll resend after any other comments. Please do not apply as is, Tom.
Thanks, -Joe