diff options
| author | Syndamia <kamen@syndamia.com> | 2026-04-30 11:04:29 +0300 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2026-05-12 07:08:56 +0300 |
| commit | 8eb996ccb042a9ddb0c69ca1d7083c431f6e03b0 (patch) | |
| tree | 3cdf861543eb1387484793b652317bdfd87a5529 /MemoryManager.c | |
| parent | 58374e851737e1bcbc697af9e14d630be66e1f4f (diff) | |
| download | foollib-8eb996ccb042a9ddb0c69ca1d7083c431f6e03b0.tar foollib-8eb996ccb042a9ddb0c69ca1d7083c431f6e03b0.tar.gz foollib-8eb996ccb042a9ddb0c69ca1d7083c431f6e03b0.zip | |
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.
Diffstat (limited to 'MemoryManager.c')
| -rw-r--r-- | MemoryManager.c | 9 |
1 files changed, 9 insertions, 0 deletions
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, }; } |
