Browse Source

move __memalign declaration to malloc_impl.h

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).
master
Rich Felker 8 years ago
parent
commit
b07a5d6698
  1. 2
      src/internal/malloc_impl.h
  2. 3
      src/malloc/aligned_alloc.c
  3. 3
      src/malloc/posix_memalign.c

2
src/internal/malloc_impl.h

@ -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;

3
src/malloc/aligned_alloc.c

@ -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)
{

3
src/malloc/posix_memalign.c

@ -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)
{

Loading…
Cancel
Save