From 2e8feafae869abba81289e5c6f56487b75a7a582 Mon Sep 17 00:00:00 2001 From: CK Tan Date: Mon, 26 Oct 2020 13:52:28 -0700 Subject: [PATCH] enhance toml_set_memutil to assign default --- toml.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/toml.c b/toml.c index f0a80bc..b41b647 100644 --- a/toml.c +++ b/toml.c @@ -46,10 +46,10 @@ void toml_set_memutil(void* (*xxmalloc)(size_t), void* (*xxcalloc)(size_t, size_t), void* (*xxrealloc)(void*, size_t)) { - ppmalloc = xxmalloc; - ppfree = xxfree; - ppcalloc = xxcalloc; - pprealloc = xxrealloc; + if (xxmalloc) ppmalloc = xxmalloc; + if (xxfree) ppfree = xxfree; + if (xxcalloc) ppcalloc = xxcalloc; + if (xxrealloc) pprealloc = xxrealloc; }