public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] db/malloc: Use posix_memalign instead of deprecated valloc
@ 2019-05-06 21:03 Rosen Penev
  2019-05-06 22:20 ` Eric Sandeen
  0 siblings, 1 reply; 3+ messages in thread
From: Rosen Penev @ 2019-05-06 21:03 UTC (permalink / raw)
  To: linux-xfs

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))
 		return ptr;
 	badmalloc();
 	/* NOTREACHED */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-06 22:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox