From 1a0e720be8fdf5cc1114387c16ba15a1432798a1 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 17 Sep 2021 14:05:23 -0700 Subject: [PATCH] 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. --- desktop_version/src/SteamNetwork.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/SteamNetwork.c b/desktop_version/src/SteamNetwork.c index dd98ba43..ae008aa4 100644 --- a/desktop_version/src/SteamNetwork.c +++ b/desktop_version/src/SteamNetwork.c @@ -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; \ }