[PATCH] tests: use xmalloc to allocate implementation array
Siddhesh Poyarekar
siddhesh@sourceware.org
Wed Jul 28 07:31:59 GMT 2021
On 7/28/21 12:55 PM, Florian Weimer wrote:
> * Siddhesh Poyarekar via Libc-alpha:
>
>> diff --git a/benchtests/bench-string.h b/benchtests/bench-string.h
>> index fd25264417..03de372cff 100644
>> --- a/benchtests/bench-string.h
>> +++ b/benchtests/bench-string.h
>> @@ -18,6 +18,7 @@
>>
>> #include <getopt.h>
>> #include <sys/cdefs.h>
>> +#include <support/support.h>
>>
>> /* We are compiled under _ISOMAC, so libc-symbols.h does not do this
>> for us. */
>> @@ -200,8 +201,8 @@ static impl_t *impl_array;
>> skip = impl; \
>> else \
>> impl_count++; \
>> - a = impl_array = malloc ((impl_count + func_count) * \
>> - sizeof (impl_t)); \
>> + a = impl_array = xmalloc ((impl_count + func_count) * \
>> + sizeof (impl_t)); \
>> for (impl = __start_impls; impl < __stop_impls; ++impl) \
>> if (impl != skip) \
>> *a++ = *impl; \
>
> I'm surprised the benchtests link against libsupport. There's some
> non-trivial setup code involved in libsupport for failure handling, and
> that gets linked into xmalloc. It might affect the benchmarks.
Yeah, it may not hurt to wean them away; it's really just the string
benchmarks that were copied over from tests and adapted. I'll use
programs/xmalloc.h here then.
Siddhesh
More information about the Libc-alpha
mailing list