diff options
author | dx <dx@dxzone.com.ar> | 2015-11-01 13:40:54 -0300 |
---|---|---|
committer | dx <dx@dxzone.com.ar> | 2015-11-01 13:40:54 -0300 |
commit | 8d1f667100fdd5ff331f4f9e4b922c4a9db7c53d (patch) | |
tree | 56565b597306522970264c7401afc54d5f36f9ab /src/core | |
parent | 897ceedc16fd2a24e75529480a7b7bc6ca769073 (diff) | |
parent | 2127fd362e240a9fed09dff9044fe5c477fc2bf8 (diff) | |
download | irssi-8d1f667100fdd5ff331f4f9e4b922c4a9db7c53d.zip |
Merge pull request #320 from irssi/ahf/add-setting-type-any
Fix warnings
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/settings.c | 9 | ||||
-rw-r--r-- | src/core/settings.h | 3 |
2 files changed, 7 insertions, 5 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 */ diff --git a/src/core/settings.h b/src/core/settings.h index af00cc80..6f2cf129 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -7,7 +7,8 @@ typedef enum { SETTING_TYPE_BOOLEAN, SETTING_TYPE_TIME, SETTING_TYPE_LEVEL, - SETTING_TYPE_SIZE + SETTING_TYPE_SIZE, + SETTING_TYPE_ANY } SettingType; typedef struct { |