From 8eb996ccb042a9ddb0c69ca1d7083c431f6e03b0 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 30 Apr 2026 11:04:29 +0300 Subject: feat(MemoryManager): Implement global M_STD This is useful in case you don't want to use a specific memory manager. Anywhere you've included a feature, which uses memory manager, you can always provide M_STD without having to create (and manage) your own value. --- MemoryManager.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'MemoryManager.c') diff --git a/MemoryManager.c b/MemoryManager.c index dd3a7fc..3f8d054 100644 --- a/MemoryManager.c +++ b/MemoryManager.c @@ -38,6 +38,14 @@ std_destroy(MemoryManager *mm) { return R_Unavailable; } +const MemoryManager M_STD = { + .alloc = &std_alloc, + .realloc = &std_realloc, + .free = &std_free, + .destroy = &std_destroy, + .priv = NULL, + }; + MemoryManager M_std() { return (MemoryManager){ @@ -45,6 +53,7 @@ M_std() { .realloc = &std_realloc, .free = &std_free, .destroy = &std_destroy, + .priv = NULL, }; } -- cgit v1.2.3