From 865606a3e8d2813362db3e0b0a46f8b9ddbe8fb5 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 12 Mar 2009 12:16:10 -0700 Subject: [PATCH] conf: enable default values --- src/config.cc | 16 ++++++++-------- src/config.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/config.cc b/src/config.cc index 80cf5029cfa82..d9231163eded8 100644 --- a/src/config.cc +++ b/src/config.cc @@ -798,10 +798,10 @@ char *conf_post_process_val(const char *val) return strdup(buf); } -#define OPT_READ_TYPE(section, var, type, inout) \ - cf->read(section, var, (type *)inout, NULL) +#define OPT_READ_TYPE(section, var, type, inout, def) \ + cf->read(section, var, (type *)inout, def) -int conf_read_key(const char *alt_section, const char *key, opt_type_t type, void *out) +int conf_read_key(const char *alt_section, const char *key, opt_type_t type, void *inout) { int s; int ret; @@ -834,19 +834,19 @@ int conf_read_key(const char *alt_section, const char *key, opt_type_t type, voi switch (type) { case OPT_STR: - ret = OPT_READ_TYPE(section, key, char *, out); + ret = OPT_READ_TYPE(section, key, char *, inout, *(char **)inout); break; case OPT_BOOL: - ret = OPT_READ_TYPE(section, key, bool, out); + ret = OPT_READ_TYPE(section, key, bool, inout, *(bool *)inout); break; case OPT_INT: - ret = OPT_READ_TYPE(section, key, int, out); + ret = OPT_READ_TYPE(section, key, int, inout, *(int *)inout); break; case OPT_FLOAT: - ret = OPT_READ_TYPE(section, key, float, out); + ret = OPT_READ_TYPE(section, key, float, inout, *(float *)inout); break; case OPT_DOUBLE: - ret = OPT_READ_TYPE(section, key, double, out); + ret = OPT_READ_TYPE(section, key, double, inout, *(double *)inout); break; default: ret = 0; diff --git a/src/config.h b/src/config.h index 2fa4e3909301f..a1471da67640c 100644 --- a/src/config.h +++ b/src/config.h @@ -378,7 +378,7 @@ class ConfFile; ConfFile *conf_get_conf_file(); char *conf_post_process_val(const char *val); -int conf_read_key(const char *alt_section, const char *key, opt_type_t type, void *out); +int conf_read_key(const char *alt_section, const char *key, opt_type_t type, void *inout); #include "common/debug.h" -- 2.39.5