1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

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

View file

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