summaryrefslogtreecommitdiff
path: root/src/core/settings.c
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@0x90.dk>2015-10-02 20:25:14 +0200
committerAlexander Færøy <ahf@0x90.dk>2015-10-03 19:01:16 +0200
commit685d8fe5b033ffce40b02aaf4ec3341f5cf3350c (patch)
tree2e2501a2580505e0d210814fdc1ea0cb3056613f /src/core/settings.c
parent48375c3f900f56434441caa0161c0531fd0ce435 (diff)
downloadirssi-685d8fe5b033ffce40b02aaf4ec3341f5cf3350c.zip
Add SETTING_TYPE_ANY and replace -1 with it.
Diffstat (limited to 'src/core/settings.c')
-rw-r--r--src/core/settings.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/settings.c b/src/core/settings.c
index b34a5766..8e493124 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -59,7 +59,7 @@ static SETTINGS_REC *settings_get(const char *key, SettingType type)
g_warning("settings_get(%s) : not found", key);
return NULL;
}
- if (type != -1 && rec->type != type) {
+ if (type != SETTING_TYPE_ANY && rec->type != type) {
g_warning("settings_get(%s) : invalid type", key);
return NULL;
}
@@ -85,7 +85,7 @@ settings_get_str_type(const char *key, SettingType type)
const char *settings_get_str(const char *key)
{
- return settings_get_str_type(key, -1);
+ return settings_get_str_type(key, SETTING_TYPE_ANY);
}
int settings_get_int(const char *key)
@@ -163,6 +163,7 @@ char *settings_get_print(SETTINGS_REC *rec)
case SETTING_TYPE_TIME:
case SETTING_TYPE_LEVEL:
case SETTING_TYPE_SIZE:
+ case SETTING_TYPE_ANY:
value = g_strdup(settings_get_str(rec->key));
break;
}
@@ -380,10 +381,10 @@ SettingType settings_get_type(const char *key)
{
SETTINGS_REC *rec;
- g_return_val_if_fail(key != NULL, -1);
+ g_return_val_if_fail(key != NULL, SETTING_TYPE_ANY);
rec = g_hash_table_lookup(settings, key);
- return rec == NULL ? -1 : rec->type;
+ return rec == NULL ? SETTING_TYPE_ANY : rec->type;
}
/* Get the record of the setting */