From c258ead85b2b9a426a643be78e3e10d215ff2b6c Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Wed, 29 May 2024 09:45:10 +0900 Subject: [PATCH] Include headers for malloc() explicitly; fix #6277 We need to include stdlib.h and malloc.h to use malloc()/free() but they aren't included in src/string.c with WIN32_LEAN_AND_MEAN. It generates build time warnings. We can solve this by including stdlib.h and malloc.h explicitly. --- src/string.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/string.c b/src/string.c index 3e30a702c..61f30e4ae 100644 --- a/src/string.c +++ b/src/string.c @@ -6,6 +6,7 @@ #ifdef _MSC_VER # define _CRT_NONSTDC_NO_DEPRECATE +# define WIN32_LEAN_AND_MEAN #endif #include @@ -840,6 +841,8 @@ str_rindex(mrb_state *mrb, mrb_value str, mrb_value sub, mrb_int pos) } #ifdef _WIN32 +#include +#include #include char*