From: Dave Chinner <david@fromorbit.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Rosen Penev <rosenp@gmail.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] db/malloc: Use posix_memalign instead of deprecated valloc
Date: Tue, 7 May 2019 08:51:01 +1000 [thread overview]
Message-ID: <20190506225101.GN29573@dread.disaster.area> (raw)
In-Reply-To: <b85f5489-70ed-3145-3989-592ee1de3899@sandeen.net>
On Mon, May 06, 2019 at 05:20:11PM -0500, Eric Sandeen wrote:
>
>
> On 5/6/19 4:03 PM, Rosen Penev wrote:
> > valloc is not available with uClibc-ng as well as being deprecated, which
> > causes compilation errors. aligned_alloc is not available before C11 so
> > used posix_memalign.'
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> > db/malloc.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/db/malloc.c b/db/malloc.c
> > index 77b3e022..38fe0b05 100644
> > --- a/db/malloc.c
> > +++ b/db/malloc.c
> > @@ -44,8 +44,7 @@ xmalloc(
> > {
> > void *ptr;
> >
> > - ptr = valloc(size);
> > - if (ptr)
> > + if(!posix_memalign(&ptr, sysconf(_SC_PAGESIZE), size))
>
>
> I'll stick a space after the 'if' but otherwise, seems fine, thanks.
>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Can we just get rid of db/malloc.[ch]? They are just a set
of wrappers that exit() when malloc fails, largely used by the
deprecated xfs_check functionality we still have hidden inside
xfs_db. Be a useful code self-documentation exercise to get rid
of them to indicate that the callers don't actually handle malloc
failures at all....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2019-05-06 22:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-06 21:03 [PATCH] db/malloc: Use posix_memalign instead of deprecated valloc Rosen Penev
2019-05-06 22:20 ` Eric Sandeen
2019-05-06 22:51 ` Dave Chinner [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190506225101.GN29573@dread.disaster.area \
--to=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
--cc=rosenp@gmail.com \
--cc=sandeen@sandeen.net \
/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