-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmalloc.h
More file actions
39 lines (31 loc) · 863 Bytes
/
malloc.h
File metadata and controls
39 lines (31 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef MALLOC_H
#define MALLOC_H
#include <stddef.h>
/* See https://nullprogram.com/blog/2023/10/08/
* #define assert(c) while (!(c)) __builtin_unreachable()
*/
/* Get your bearings in the debugger.
*/
#define MAGIC_BABY 0xbebebebe
#define MAGIC_SPENT 0xdededede
enum {
ALIGNMENT = 16,
MIN_BLKSZ = 64, /* (?) This ought to at least be bigger than the
* header. */
MIN_MMAPSZ = 64 * 1024,
};
/* If a is a power of 2, round n up to the next multiple of a.
*/
#define ALIGN_UP(n,a) ( ((n) + (a) - 1) & ~((a) - 1) )
/* Opaque types to avoid exposing layout.
*/
struct span;
struct block;
/* Internal malloc API. These are wrapped in the real malloc() names in
* exports.c.
*/
void *m_malloc(size_t n);
void *m_calloc(size_t n, size_t s);
void *m_realloc(void *p, size_t size);
void m_free(void *p);
#endif