resolved some warnings
This commit is contained in:
parent
faab3f7fee
commit
0dcf0d5454
15
src/rtext.c
15
src/rtext.c
|
|
@ -1361,8 +1361,8 @@ const char *TextFormat(const char *text, ...)
|
||||||
if (!text)
|
if (!text)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
|
static char formatBuffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
|
||||||
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
|
memset(formatBuffer, 0, MAX_TEXT_BUFFER_LENGTH);
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, text);
|
va_start(args, text);
|
||||||
|
|
@ -1375,20 +1375,13 @@ const char *TextFormat(const char *text, ...)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer == NULL)
|
|
||||||
{
|
|
||||||
// Handle memory allocation failure
|
|
||||||
va_end(args);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
va_end(args); // Reset the va_list
|
va_end(args); // Reset the va_list
|
||||||
|
|
||||||
va_start(args, text); // Start again for the actual formatting
|
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);
|
va_end(args);
|
||||||
|
|
||||||
return buffer;
|
return formatBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get integer value from text
|
// Get integer value from text
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user