summaryrefslogtreecommitdiffstats
path: root/src/malloc.h
blob: b969988ab5349a754a6315b28108605eee73f22c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef foosydneymallochfoo
#define foosydneymallochfoo

#include <stdlib.h>
#include <string.h>

#define sa_malloc malloc
#define sa_free free
#define sa_malloc0(size) calloc(1, (size))
#define sa_strdup strdup
#define sa_strndup strndup

void* sa_memdup(const void* p, size_t size);

#define sa_new(t, n) ((t*) sa_malloc(sizeof(t)*(n)))
#define sa_new0(t, n) ((t*) sa_malloc0(sizeof(t)*(n)))
#define sa_newdup(t, p, n) ((t*) sa_memdup(p, sizeof(t)*(n)))

#endif