Unified method for testing if c strings contain a value

This commit is contained in:
Linus Dierheimer
2022-01-07 18:00:38 +01:00
parent 3f30fa8d4a
commit 0879746e0f
8 changed files with 44 additions and 23 deletions
+1 -1
View File
@@ -155,7 +155,7 @@ static bool printCursorFromEnv(FFinstance* instance)
{
const char* xcursor_theme = getenv("XCURSOR_THEME");
if(xcursor_theme == NULL || *xcursor_theme == '\0')
if(!ffStrSet(xcursor_theme))
return false;
FFstrbuf theme;
+2 -2
View File
@@ -64,7 +64,7 @@ static void printWMThemeFromSettings(FFinstance* instance, const char* dconfKey,
{
const char* theme = ffSettingsGet(instance, dconfKey, gsettingsSchemaName, gsettingsPath, gsettingsKey, FF_VARIANT_TYPE_STRING).strValue;
if(theme == NULL || *theme == '\0')
if(!ffStrSet(theme))
{
ffPrintError(instance, FF_WMTHEME_MODULE_NAME, 0, &instance->config.wmThemeKey, &instance->config.wmThemeFormat, FF_WMTHEME_NUM_FORMAT_ARGS, "Couldn't find WM theme in DConf or GSettings");
return;
@@ -105,7 +105,7 @@ static void printGTKThemeAsWMTheme(FFinstance* instance)
static void printMutter(FFinstance* instance)
{
const char* theme = ffSettingsGet(instance, "/org/gnome/shell/extensions/user-theme/name", "org.gnome.shell.extensions.user-theme", NULL, "name", FF_VARIANT_TYPE_STRING).strValue;
if(theme != NULL && *theme != '\0')
if(ffStrSet(theme))
{
printWMTheme(instance, theme);
return;