From: Rich Felker Date: Wed, 3 Jun 2020 01:40:05 +0000 (-0400) Subject: move malloc_impl.h from src/internal to src/malloc X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=135c94f097c8a82ba29cc184b1ee6a9a69da04ed;p=oweals%2Fmusl.git move malloc_impl.h from src/internal to src/malloc this reflects that it is no longer intended for consumption outside of the malloc implementation. --- diff --git a/src/internal/malloc_impl.h b/src/internal/malloc_impl.h deleted file mode 100644 index 2c61b3ff..00000000 --- a/src/internal/malloc_impl.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef MALLOC_IMPL_H -#define MALLOC_IMPL_H - -#include -#include "dynlink.h" - -hidden void *__expand_heap(size_t *); - -hidden void *__memalign(size_t, size_t); - -struct chunk { - size_t psize, csize; - struct chunk *next, *prev; -}; - -struct bin { - volatile int lock[2]; - struct chunk *head; - struct chunk *tail; -}; - -#define SIZE_ALIGN (4*sizeof(size_t)) -#define SIZE_MASK (-SIZE_ALIGN) -#define OVERHEAD (2*sizeof(size_t)) -#define MMAP_THRESHOLD (0x1c00*SIZE_ALIGN) -#define DONTCARE 16 -#define RECLAIM 163840 - -#define CHUNK_SIZE(c) ((c)->csize & -2) -#define CHUNK_PSIZE(c) ((c)->psize & -2) -#define PREV_CHUNK(c) ((struct chunk *)((char *)(c) - CHUNK_PSIZE(c))) -#define NEXT_CHUNK(c) ((struct chunk *)((char *)(c) + CHUNK_SIZE(c))) -#define MEM_TO_CHUNK(p) (struct chunk *)((char *)(p) - OVERHEAD) -#define CHUNK_TO_MEM(c) (void *)((char *)(c) + OVERHEAD) -#define BIN_TO_CHUNK(i) (MEM_TO_CHUNK(&mal.bins[i].head)) - -#define C_INUSE ((size_t)1) - -#define IS_MMAPPED(c) !((c)->csize & (C_INUSE)) - -hidden void __bin_chunk(struct chunk *); - -#endif diff --git a/src/malloc/malloc_impl.h b/src/malloc/malloc_impl.h new file mode 100644 index 00000000..2c61b3ff --- /dev/null +++ b/src/malloc/malloc_impl.h @@ -0,0 +1,43 @@ +#ifndef MALLOC_IMPL_H +#define MALLOC_IMPL_H + +#include +#include "dynlink.h" + +hidden void *__expand_heap(size_t *); + +hidden void *__memalign(size_t, size_t); + +struct chunk { + size_t psize, csize; + struct chunk *next, *prev; +}; + +struct bin { + volatile int lock[2]; + struct chunk *head; + struct chunk *tail; +}; + +#define SIZE_ALIGN (4*sizeof(size_t)) +#define SIZE_MASK (-SIZE_ALIGN) +#define OVERHEAD (2*sizeof(size_t)) +#define MMAP_THRESHOLD (0x1c00*SIZE_ALIGN) +#define DONTCARE 16 +#define RECLAIM 163840 + +#define CHUNK_SIZE(c) ((c)->csize & -2) +#define CHUNK_PSIZE(c) ((c)->psize & -2) +#define PREV_CHUNK(c) ((struct chunk *)((char *)(c) - CHUNK_PSIZE(c))) +#define NEXT_CHUNK(c) ((struct chunk *)((char *)(c) + CHUNK_SIZE(c))) +#define MEM_TO_CHUNK(p) (struct chunk *)((char *)(p) - OVERHEAD) +#define CHUNK_TO_MEM(c) (void *)((char *)(c) + OVERHEAD) +#define BIN_TO_CHUNK(i) (MEM_TO_CHUNK(&mal.bins[i].head)) + +#define C_INUSE ((size_t)1) + +#define IS_MMAPPED(c) !((c)->csize & (C_INUSE)) + +hidden void __bin_chunk(struct chunk *); + +#endif