OSDN Git Service

move __memalign declaration to malloc_impl.h
authorRich Felker <dalias@aerifal.cx>
Tue, 11 Sep 2018 00:28:47 +0000 (20:28 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 12 Sep 2018 18:34:32 +0000 (14:34 -0400)
the malloc-implementation-private header is the only right place for
this, because, being in the reserved namespace, __memalign is not
interposable and thus not valid to use anywhere else. anything outside
of the malloc implementation must call an appropriate-namespace public
function (aligned_alloc or posix_memalign).

src/internal/malloc_impl.h
src/malloc/aligned_alloc.c
src/malloc/posix_memalign.c

index 40d1696..88b4f67 100644 (file)
@@ -12,6 +12,8 @@ void *__expand_heap(size_t *);
 
 void __malloc_donate(char *, char *);
 
+void *__memalign(size_t, size_t);
+
 struct chunk {
        size_t psize, csize;
        struct chunk *next, *prev;
index cc0a801..b6143f3 100644 (file)
@@ -1,6 +1,5 @@
 #include <stdlib.h>
-
-void *__memalign(size_t, size_t);
+#include "malloc_impl.h"
 
 void *aligned_alloc(size_t align, size_t len)
 {
index cf67db6..2ea8bd8 100644 (file)
@@ -1,7 +1,6 @@
 #include <stdlib.h>
 #include <errno.h>
-
-void *__memalign(size_t, size_t);
+#include "malloc_impl.h"
 
 int posix_memalign(void **res, size_t align, size_t len)
 {