From a0bd1a3f3b83bf57e83341f85e54ad4210eac3e0 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Mon, 2 Jun 2025 15:09:10 +0800 Subject: [PATCH] Update config.h --- include/pocketpy/config.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/pocketpy/config.h b/include/pocketpy/config.h index f4d9dec6..6f3a6bcd 100644 --- a/include/pocketpy/config.h +++ b/include/pocketpy/config.h @@ -27,9 +27,15 @@ // Memory allocation functions #ifndef PK_MALLOC -#define PK_MALLOC(size) malloc(size) -#define PK_REALLOC(ptr, size) realloc(ptr, size) -#define PK_FREE(ptr) free(ptr) + #ifndef __cplusplus + #define PK_MALLOC(size) malloc(size) + #define PK_REALLOC(ptr, size) realloc(ptr, size) + #define PK_FREE(ptr) free(ptr) + #else + #define PK_MALLOC(size) std::malloc(size) + #define PK_REALLOC(ptr, size) std::realloc(ptr, size) + #define PK_FREE(ptr) std::free(ptr) + #endif #endif // This is the maximum size of the value stack in py_TValue units