unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar via Libc-alpha <libc-alpha@sourceware.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v2] tests: use xmalloc to allocate implementation array
Date: Wed, 28 Jul 2021 13:33:00 +0530	[thread overview]
Message-ID: <e134aac0-8767-6916-32f5-10de7a7057d1@sourceware.org> (raw)
In-Reply-To: <875ywuamzd.fsf@oldenburg.str.redhat.com>

On 7/28/21 1:28 PM, Florian Weimer wrote:
> * Siddhesh Poyarekar:
> 
>> The benchmark and tests must fail in case of allocation failure in the
>> implementation array.  Also annotate the x* allocators in support.h so
>> that the compiler has more information about them.
>> ---
>>   benchtests/bench-string.h |  5 +++--
>>   string/test-string.h      |  5 +++--
>>   support/support.h         | 24 +++++++++++++++++-------
>>   3 files changed, 23 insertions(+), 11 deletions(-)
>>
>> diff --git a/benchtests/bench-string.h b/benchtests/bench-string.h
>> index fd25264417..12f27473ff 100644
>> --- a/benchtests/bench-string.h
>> +++ b/benchtests/bench-string.h
>> @@ -18,6 +18,7 @@
>>   
>>   #include <getopt.h>
>>   #include <sys/cdefs.h>
>> +#include <programs/xmalloc.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;						      \
> 
> Okay if it actually links.
> 

It does because it uses the xmalloc in libsupport.  I'll wean the 
benchmarks away from libsupport in 2.35.

Siddhesh

  reply	other threads:[~2021-07-28  8:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28  7:35 [PATCH v2] tests: use xmalloc to allocate implementation array Siddhesh Poyarekar via Libc-alpha
2021-07-28  7:58 ` Florian Weimer via Libc-alpha
2021-07-28  8:03   ` Siddhesh Poyarekar via Libc-alpha [this message]
2021-07-28 10:25   ` Siddhesh Poyarekar via Libc-alpha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e134aac0-8767-6916-32f5-10de7a7057d1@sourceware.org \
    --to=libc-alpha@sourceware.org \
    --cc=fweimer@redhat.com \
    --cc=siddhesh@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).