From 251c24e3b6df56b903c4de60b4a8884288f613e4 Mon Sep 17 00:00:00 2001 From: sanine Date: Mon, 16 Oct 2023 11:33:04 -0500 Subject: fix c++ compilation errors and string.h include --- lily-test.h | 5 +++-- 1 file 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 #include #include +#include #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; -- cgit v1.2.1