Skip to content

Commit cadaf23

Browse files
committed
fix: optional omalloc parts
1 parent 6fcddc9 commit cadaf23

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

omalloc/omalloc.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#define OM_MARK_AS_STATIC(addr) ((void)0)
2121
#endif
2222

23+
#if OM_PROVIDE_MALLOC > 0
24+
2325
void* calloc(size_t nmemb, size_t size)
2426
{
2527
void* addr;
@@ -32,16 +34,6 @@ void* calloc(size_t nmemb, size_t size)
3234
return addr;
3335
}
3436

35-
void* malloc(size_t size)
36-
{
37-
void* addr;
38-
if (size == 0) size = 1;
39-
40-
omTypeAllocAligned(void*, addr, size);
41-
OM_MARK_AS_STATIC(addr);
42-
return addr;
43-
}
44-
4537
void free(void* addr)
4638
{
4739
omfree(addr);
@@ -101,6 +93,18 @@ char* strdup_(const char* addr)
10193
return NULL;
10294
}
10395
#endif
96+
#endif
97+
98+
void* malloc(size_t size)
99+
{
100+
void* addr;
101+
if (size == 0) size = 1;
102+
103+
omTypeAllocAligned(void*, addr, size);
104+
OM_MARK_AS_STATIC(addr);
105+
return addr;
106+
}
107+
104108
void freeSize(void* addr, size_t size)
105109
{
106110
if (addr) omFreeSize(addr, size);

0 commit comments

Comments
 (0)