Don't use print formatting for hardcoded strings

If the string is hardcoded, then use compile-time string literal
concatenation instead.

I don't know if compilers are smart enough to recognize when you're
passing in hardcoded strings and to concatenate them into the string
literal at compile time instead. I also don't know that if compilers are
smart enough to recognize that, that further they recognize all the
logging functions are just wrappers around printf, and so they can
perform the same optimization at those function call sites, too. So it's
better to just do the string concatenation explicitly instead.
This commit is contained in:
Misa 2021-09-17 14:05:23 -07:00
parent 32f30020fa
commit 1a0e720be8
1 changed files with 2 additions and 2 deletions

View File

@ -88,7 +88,7 @@ int32_t STEAM_init(void)
libHandle = SDL_LoadObject(STEAM_LIBRARY);
if (!libHandle)
{
vlog_info("%s not found!", STEAM_LIBRARY);
vlog_info(STEAM_LIBRARY " not found!");
return 0;
}
@ -96,7 +96,7 @@ int32_t STEAM_init(void)
name = (rettype (*) params) SDL_LoadFunction(libHandle, #name); \
if (!name) \
{ \
vlog_error("%s symbol %s not found!", STEAM_LIBRARY, #name); \
vlog_error(STEAM_LIBRARY " symbol " #name " not found!"); \
ClearPointers(); \
return 0; \
}