Actually nah, don't wanna mimic stdlib (it causes more harm than good)
This commit is contained in:
parent
08703389db
commit
467746b30e
3 changed files with 5 additions and 27 deletions
|
|
@ -15,13 +15,4 @@ void* axl_memcpy(void* dst, const void* src, u32 count);
|
||||||
i32 axl_memcmp(const void* s1, const void* s2, u32 n);
|
i32 axl_memcmp(const void* s1, const void* s2, u32 n);
|
||||||
void axl_free(void* ptr);
|
void axl_free(void* ptr);
|
||||||
|
|
||||||
#ifdef AXL_MIMIC_STDLIB
|
|
||||||
#define malloc axl_malloc
|
|
||||||
#define realloc axl_realloc
|
|
||||||
#define memset axl_memset
|
|
||||||
#define memcpy axl_memcpy
|
|
||||||
#define memcmp axl_memcmp
|
|
||||||
#define free axl_free
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
12
axl_string.h
12
axl_string.h
|
|
@ -12,16 +12,4 @@ i32 axl_strncmp(const i8* s1, const i8* s2, u32 n);
|
||||||
const i8* axl_strchr(const i8* str, i8 c);
|
const i8* axl_strchr(const i8* str, i8 c);
|
||||||
i8* axl_strstr(const i8* str, const i8* substr);
|
i8* axl_strstr(const i8* str, const i8* substr);
|
||||||
|
|
||||||
#ifdef AXL_MIMIC_STDLIB
|
|
||||||
#define strlen axl_strlen
|
|
||||||
#define strcpy axl_strcpy
|
|
||||||
#define strncpy axl_strncpy
|
|
||||||
#define strcat axl_strcat
|
|
||||||
#define strncat axl_strncat
|
|
||||||
#define strcmp axl_strcmp
|
|
||||||
#define strncmp axl_strncmp
|
|
||||||
#define strchr axl_strchr
|
|
||||||
#define strstr axl_strstr
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // AXL_STRING
|
#endif // AXL_STRING
|
||||||
|
|
|
||||||
11
main.c
11
main.c
|
|
@ -1,18 +1,17 @@
|
||||||
#define AXL_MIMIC_STDLIB
|
|
||||||
#include "axl.h"
|
#include "axl.h"
|
||||||
|
|
||||||
int _start(void)
|
int _start(void)
|
||||||
{
|
{
|
||||||
axl_init();
|
axl_init();
|
||||||
|
|
||||||
void* fds = malloc(83);
|
void* fds = axl_malloc(83);
|
||||||
|
|
||||||
int* f = malloc(sizeof(int));
|
int* f = axl_malloc(sizeof(int));
|
||||||
*f = 4;
|
*f = 4;
|
||||||
*(int*)(fds) = 4;
|
*(int*)(fds) = 4;
|
||||||
(void)memcmp(f, fds, 4);
|
(void)axl_memcmp(f, fds, 4);
|
||||||
free(fds);
|
axl_free(fds);
|
||||||
free(f);
|
axl_free(f);
|
||||||
|
|
||||||
(void)fds;
|
(void)fds;
|
||||||
(void)f;
|
(void)f;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue