blob: 238cf39e6ee96a3f13964f6cee29bcb2fbcbee93 (
plain)
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
|
// 7 april 2015
#include <stdio.h>
#include "uipriv_unix.h"
void *uiAlloc(size_t size, const char *type)
{
void *out;
out = g_malloc0(size);
#ifdef uiLogAllocations
fprintf(stderr, "%p alloc %s\n", out, type);
#endif
return out;
}
void *uiRealloc(void *p, size_t size, const char *type)
{
void *out;
if (p == NULL)
return uiAlloc(size, type);
// TODO fill with 0s
out = g_realloc(p, size);
#ifdef uiLogAllocations
fprintf(stderr, "%p realloc %p\n", p, out);
#endif
return out;
}
void uiFree(void *p)
{
g_free(p);
#ifdef uiLogAllocations
fprintf(stderr, "%p free\n", p);
#endif
}
|