This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] misc: Add twalk_r function
- From: Florian Weimer <fweimer at redhat dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 01 May 2019 08:11:52 +0200
- Subject: Re: [PATCH] misc: Add twalk_r function
- References: <87ef5lezyp.fsf@oldenburg2.str.redhat.com> <7bf390ba-aa66-5c90-b39b-e23f75156131@linaro.org>
* Adhemerval Zanella:
> On 29/04/2019 09:51, Florian Weimer wrote:
>> The twalk function is very difficult to use in a multi-threaded
>> program because there is no way to pass external state to the
>> iterator function.
>
> LGTM as well, with some nits below (the whitespace you seems to
> fixed already).
>
>>
>> (I expect to use this new function in sem_close and
>> __gconv_release_shlib, but the function is generally useful.)
>
> As a side note I worked on a sem_open/sem_close refactor some time ago
> that uses dynarray and the char array derived structure, aimed to remove
> both the twalk and alloca internal usage. It turned to be a slight simpler
> implementation as well and I will try to send it upstream.
>
> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
I assume this should be your Reviewed-by?
>> diff --git a/NEWS b/NEWS
>> index 792ffb1ec8..a32bcbd7a4 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -16,6 +16,8 @@ Major new features:
>> * The dynamic linker accepts the --preload argument to preload shared
>> objects, in addition to the LD_PRELOAD environment variable.
>>
>> +* The twalk_r function has been added.
>> +
>
> I think we can extend it description a bit by adding it is a GNU extension
> that behaves like twalk but with an addional parameter to be passed in
> callback action function (like qsort_r).
“The twalk_r function has been added. It is similar to the existing
twalk function, but it passes an additional caller-supplied argument to
the callback function.”
Thanks,
Florian