unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Siddhesh Poyarekar via Libc-alpha <libc-alpha@sourceware.org>
Cc: Siddhesh Poyarekar <siddhesh@sourceware.org>
Subject: Re: [PATCH] realloc: Return unchanged if request is within usable size
Date: Mon, 28 Nov 2022 15:29:36 +0100	[thread overview]
Message-ID: <mvmedtn884v.fsf@linux-m68k.org> (raw)
In-Reply-To: <e67dba8d-3185-6ceb-1287-f91f56b2a862@sourceware.org> (Siddhesh Poyarekar via Libc-alpha's message of "Mon, 28 Nov 2022 09:23:08 -0500")

On Nov 28 2022, Siddhesh Poyarekar via Libc-alpha wrote:

> Hmm, I suppose something like this then?
>
>     for (...)
>       {
>         ...
>         volatile uintptr_t oldp = p;
>         void *new_p = realloc (p, newsz)
>         if (new_p != oldp)
>           ...

You'll need some casts, but I don't think the volatile is needed.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

  reply	other threads:[~2022-11-28 14:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 20:09 [PATCH] realloc: Return unchanged if request is within usable size Siddhesh Poyarekar via Libc-alpha
2022-11-25 20:40 ` Andreas Schwab
2022-11-28 14:23   ` Siddhesh Poyarekar via Libc-alpha
2022-11-28 14:29     ` Andreas Schwab [this message]
2022-11-28 17:26 ` [PATCH v2] " Siddhesh Poyarekar via Libc-alpha
2022-12-06 22:33   ` DJ Delorie via Libc-alpha
  -- strict thread matches above, loose matches on Subject: below --
2022-11-28  9:22 [PATCH] " Wilco Dijkstra via Libc-alpha
2022-11-28 14:13 ` Siddhesh Poyarekar via Libc-alpha
2022-12-06 12:45   ` Wilco Dijkstra via Libc-alpha
2022-12-06 18:41     ` Siddhesh Poyarekar via Libc-alpha
2023-07-03 22:02     ` Aurelien Jarno
2023-07-04 11:17       ` Siddhesh Poyarekar via Libc-alpha
2023-07-04 16:08         ` Aurelien Jarno

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=mvmedtn884v.fsf@linux-m68k.org \
    --to=schwab@linux-m68k.org \
    --cc=libc-alpha@sourceware.org \
    --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).