diff options
author | sanine <sanine.not@pm.me> | 2023-10-16 11:33:04 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-10-16 11:33:04 -0500 |
commit | 251c24e3b6df56b903c4de60b4a8884288f613e4 (patch) | |
tree | e91388263e8f18c39b9057f96bc3c60288927255 | |
parent | 7c93fe6bc9f061484d28115e9fa1ec5f89ce5924 (diff) |
fix c++ compilation errors and string.h include
-rw-r--r-- | lily-test.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lily-test.h b/lily-test.h index a4dc00a..80ba054 100644 --- a/lily-test.h +++ b/lily-test.h @@ -58,6 +58,7 @@ #include <stdarg.h> #include <stdlib.h> #include <math.h> +#include <string.h> #define STR_IMP(x) #x #define STR(x) STR_IMP(x) @@ -227,7 +228,7 @@ struct lily_global_t lily_g; lily_test_msg_t *lily_msg_create(const char *location, const char *fmt, va_list args) { - lily_test_msg_t *m = malloc(sizeof(lily_test_msg_t)); + lily_test_msg_t *m = (lily_test_msg_t*) malloc(sizeof(lily_test_msg_t)); if (m == NULL) { return NULL; } @@ -239,7 +240,7 @@ lily_test_msg_t *lily_msg_create(const char *location, const char *fmt, va_list size_t len = vsnprintf(NULL, 0, fmt, args_len) + 1; va_end(args_len); - m->msg = malloc(len * sizeof(char)); + m->msg = (char*) malloc(len * sizeof(char)); if (m->msg == NULL) { free(m); return NULL; |