From 0dcf0d5454e0e5f11304028a1a1b55647f8fae54 Mon Sep 17 00:00:00 2001 From: DissolveDZ Date: Sun, 1 Oct 2023 00:15:02 +0200 Subject: [PATCH] resolved some warnings --- src/rtext.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/rtext.c b/src/rtext.c index 9e7bc7ee5..2a736e62f 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -1361,8 +1361,8 @@ const char *TextFormat(const char *text, ...) if (!text) return ""; - static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 }; - memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH); + static char formatBuffer[MAX_TEXT_BUFFER_LENGTH] = { 0 }; + memset(formatBuffer, 0, MAX_TEXT_BUFFER_LENGTH); va_list args; va_start(args, text); @@ -1375,20 +1375,13 @@ const char *TextFormat(const char *text, ...) return NULL; } - if (buffer == NULL) - { - // Handle memory allocation failure - va_end(args); - return NULL; - } - va_end(args); // Reset the va_list va_start(args, text); // Start again for the actual formatting - vsnprintf(buffer, length + 1, text, args); // Format the string and copy it to the result buffer + vsnprintf(formatBuffer, length + 1, text, args); // Format the string and copy it to the result buffer va_end(args); - return buffer; + return formatBuffer; } // Get integer value from text