Mon Nov 29 18:59:25 PST 2004
- Previous message: [Slony1-commit] By darcyb: Duplicate file, share/slon.conf-sample is the correct home
- Next message: [Slony1-commit] By cbbrowne: Added in some code to process syncs; still very rudimentary
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Log Message:
-----------
Make it possible to easly obtain the value of a conf option
Modified Files:
--------------
slony1-engine/src/slon:
confoptions.c (r1.6 -> r1.7)
confoptions.h (r1.8 -> r1.9)
-------------- next part --------------
Index: confoptions.h
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/confoptions.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -Lsrc/slon/confoptions.h -Lsrc/slon/confoptions.h -u -w -r1.8 -r1.9
--- src/slon/confoptions.h
+++ src/slon/confoptions.h
@@ -7,6 +7,7 @@
void InitializeConfOptions(void);
bool set_config_option(const char *name, const char *value);
+void *get_config_option(const char *name);
extern double real_placeholder;
Index: confoptions.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/confoptions.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lsrc/slon/confoptions.c -Lsrc/slon/confoptions.c -u -w -r1.6 -r1.7
--- src/slon/confoptions.c
+++ src/slon/confoptions.c
@@ -15,7 +15,7 @@
static int conf_name_compare(const char *namea, const char *nameb);
bool set_config_option(const char *name, const char *value);
-
+void *get_config_option(const char *name);
bool bool_placeholder;
double real_placeholder;
@@ -353,6 +353,45 @@
return 0;
}
+void *get_config_option(const char *name)
+{
+ struct config_generic *record;
+ int elevel;
+
+ record = find_option(name, elevel);
+ if (record == NULL)
+ { slon_log(elevel, "unrecognized configuration parameter \"%s\"\n", name);
+ return NULL;
+ }
+ switch (record->vartype)
+ {
+ case SLON_C_BOOL:
+ {
+ struct config_bool *conf = (struct config_bool *) record;
+ return (void *)conf->variable;
+ break;
+ }
+ case SLON_C_INT:
+ {
+ struct config_int *conf = (struct config_int *) record;
+ return (void *)*conf->variable;
+ break;
+ }
+ case SLON_C_REAL:
+ {
+ struct config_real *conf = (struct config_real *) record;
+ return (void *)conf->variable;
+ break;
+ }
+ case SLON_C_STRING:
+ {
+ struct config_string *conf = (struct config_string *)record;
+ return (void *)*conf->variable;
+ break;
+ }
+ }
+ return NULL;
+}
bool
set_config_option(const char *name, const char *value)
- Previous message: [Slony1-commit] By darcyb: Duplicate file, share/slon.conf-sample is the correct home
- Next message: [Slony1-commit] By cbbrowne: Added in some code to process syncs; still very rudimentary
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list