summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2007-05-14 21:22:41 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2007-05-14 21:22:41 +0000
commitc235c679ccb48f90288397417dd77a8e784988dd (patch)
tree28d0d75f418fa5130c02faf4c085057ecec1ceb5
parent0a9a05c5c0e26980bdb8d0b534fb6252c9122abd (diff)
downloadirssi-c235c679ccb48f90288397417dd77a8e784988dd.zip
Remove code duplication.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4493 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/core/special-vars.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/core/special-vars.c b/src/core/special-vars.c
index df200b72..d4548715 100644
--- a/src/core/special-vars.c
+++ b/src/core/special-vars.c
@@ -87,27 +87,12 @@ static char *get_argument(char **cmd, char **arglist)
return ret;
}
-static char *get_internal_setting(const char *key, int type, int *free_ret)
-{
- switch (type) {
- case SETTING_TYPE_BOOLEAN:
- return settings_get_bool(key) ? "yes" : "no";
- case SETTING_TYPE_INT:
- *free_ret = TRUE;
- return g_strdup_printf("%d", settings_get_int(key));
- case SETTING_TYPE_STRING:
- return (char *) settings_get_str(key);
- }
-
- return NULL;
-}
-
static char *get_long_variable_value(const char *key, SERVER_REC *server,
void *item, int *free_ret)
{
EXPANDO_FUNC func;
const char *ret;
- int type;
+ SETTINGS_REC *rec;
*free_ret = FALSE;
@@ -119,9 +104,11 @@ static char *get_long_variable_value(const char *key, SERVER_REC *server,
}
/* internal setting? */
- type = settings_get_type(key);
- if (type != -1)
- return get_internal_setting(key, type, free_ret);
+ rec = settings_get_record(key);
+ if (rec != NULL) {
+ *free_ret = TRUE;
+ return settings_get_print(rec);
+ }
/* environment variable? */
ret = g_getenv(key);