]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
conf: enable default values
authorYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 12 Mar 2009 19:16:10 +0000 (12:16 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 12 Mar 2009 19:16:10 +0000 (12:16 -0700)
src/config.cc
src/config.h

index 80cf5029cfa82c733b6096dbec8dd5707c4d3d56..d9231163eded8f6164fa84a55279fa301e053f08 100644 (file)
@@ -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;
index 2fa4e3909301f91a00212ddd0773b2fa18a30c29..a1471da67640cb4905a909778ad71d9875ae1f4a 100644 (file)
@@ -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"