db/malloc: Use posix_memalign instead of deprecated valloc
PATCH 1/1 db/malloc: Use posix_memalign instead of deprecated valloc
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.'
--- db/malloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
db/malloc.c +1 -2
@@ -44,8 +44,7 @@ xmalloc( {void *ptr; - ptr =valloc (size); -if (ptr) +if (!posix_memalign (&ptr,sysconf (_SC_PAGESIZE), size))return ptr;badmalloc ();/* NOTREACHED */
Signature · 1 line
2.17.1
Quoted 14 lines · Rosen Penev
valloc is not available with uClibc-ng as well as being deprecated, which causes compilation errors.
aligned_allocis not available before C11 so usedposix_memalign.'Signed-off-by Rosen Penev <[email protected]>--- db/malloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)db/malloc.c +0
-0
db/malloc.c xmalloc( · line 47
Quoted 6 lines
db/malloc.c +1
-2@@ -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.
Quoted 4 lines
db/malloc.c +0
-0return ptr;badmalloc ();/* NOTREACHED */
Quoted 20 lines · Eric Sandeen
Quoted 17 lines · Rosen Penev
valloc is not available with uClibc-ng as well as being deprecated, which causes compilation errors.
aligned_allocis not available before C11 so usedposix_memalign.'Signed-off-by Rosen Penev <[email protected]>--- db/malloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)db/malloc.c +0
-0@@ -44,8 +44,7 @@ xmalloc( {void *ptr;
Quoted 8 lines
db/malloc.c xmalloc( · line 47
Quoted 3 lines
db/malloc.c +1
-2- 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 <[email protected]>
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.
Signature · 2 lines
Dave Chinner [email protected]