Skip to content
Snippets Groups Projects
Commit 0658a0e1 authored by Simon McVittie's avatar Simon McVittie
Browse files

steam: Generalize taking compat flags from boolean environment variables


Instead of open-coding this for just STEAM_COMPAT_TRACING, let's have
a table so we can easily add more.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 0d0cc115
No related branches found
No related tags found
1 merge request!766Make it easier for users on non-Debian-derived distros to set SDL_DYNAMIC_API
...@@ -751,21 +751,35 @@ _srt_steam_check (const char * const *envp, ...@@ -751,21 +751,35 @@ _srt_steam_check (const char * const *envp,
SrtSteamCompatFlags SrtSteamCompatFlags
_srt_steam_get_compat_flags (const char * const *envp) _srt_steam_get_compat_flags (const char * const *envp)
{ {
static const struct
{
const char *name;
SrtSteamCompatFlags value;
gboolean def;
}
bool_vars[] =
{
{ "STEAM_COMPAT_TRACING", SRT_STEAM_COMPAT_FLAGS_SYSTEM_TRACING, FALSE },
};
SrtSteamCompatFlags ret = SRT_STEAM_COMPAT_FLAGS_NONE; SrtSteamCompatFlags ret = SRT_STEAM_COMPAT_FLAGS_NONE;
const char *value; const char *value;
gboolean tracing = FALSE; size_t i;
_srt_environ_get_boolean (envp, "STEAM_COMPAT_TRACING", &tracing, NULL); for (i = 0; i < G_N_ELEMENTS (bool_vars); i++)
{
gboolean bool_value = bool_vars[i].def;
_srt_environ_get_boolean (envp, bool_vars[i].name, &bool_value, NULL);
if (tracing) if (bool_value)
ret |= SRT_STEAM_COMPAT_FLAGS_SYSTEM_TRACING; ret |= bool_vars[i].value;
}
value = _srt_environ_getenv (envp, "STEAM_COMPAT_FLAGS"); value = _srt_environ_getenv (envp, "STEAM_COMPAT_FLAGS");
if (value != NULL) if (value != NULL)
{ {
g_auto(GStrv) tokens = NULL; g_auto(GStrv) tokens = NULL;
size_t i;
tokens = g_strsplit (value, ",", 0); tokens = g_strsplit (value, ",", 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment