From: Florian Weimer via Libc-alpha <libc-alpha@sourceware.org>
To: Siddhesh Poyarekar <siddhesh@sourceware.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v2] tests: use xmalloc to allocate implementation array
Date: Wed, 28 Jul 2021 09:58:30 +0200 [thread overview]
Message-ID: <875ywuamzd.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20210728073530.3917457-1-siddhesh@sourceware.org> (Siddhesh Poyarekar's message of "Wed, 28 Jul 2021 13:05:30 +0530")
* 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.
Rest of the patch seems okay to me.
Thanks,
Florian
next prev parent reply other threads:[~2021-07-28 8:27 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 [this message]
2021-07-28 8:03 ` Siddhesh Poyarekar via Libc-alpha
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=875ywuamzd.fsf@oldenburg.str.redhat.com \
--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).