From 38730033d42c67e5fb37165926ac7603b85fa71b Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Thu, 20 Jul 2017 09:11:38 +0900 Subject: [PATCH] Miscellaneous code cleanup --- configfile.c | 10 ++++++---- configfile.h | 7 ++++--- repmgr-client.c | 15 +++++++-------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/configfile.c b/configfile.c index 4f920ebd..56c548df 100644 --- a/configfile.c +++ b/configfile.c @@ -41,7 +41,7 @@ progname(void) return _progname; } -bool +void load_config(const char *config_file, bool verbose, bool terse, t_configuration_options *options, char *argv0) { struct stat stat_config; @@ -160,11 +160,13 @@ load_config(const char *config_file, bool verbose, bool terse, t_configuration_o } } - return parse_config(options, terse); + parse_config(options, terse); + + return; } -bool +void parse_config(t_configuration_options *options, bool terse) { /* Collate configuration file errors here for friendlier reporting */ @@ -186,7 +188,7 @@ parse_config(t_configuration_options *options, bool terse) print_item_list(&config_warnings); } - return true; + return; } diff --git a/configfile.h b/configfile.h index c06f45f3..073d8188 100644 --- a/configfile.h +++ b/configfile.h @@ -157,8 +157,8 @@ typedef struct void set_progname(const char *argv0); const char *progname(void); -bool load_config(const char *config_file, bool verbose, bool terse, t_configuration_options *options, char *argv0); -bool parse_config(t_configuration_options *options, bool terse); +void load_config(const char *config_file, bool verbose, bool terse, t_configuration_options *options, char *argv0); +void parse_config(t_configuration_options *options, bool terse); bool reload_config(t_configuration_options *orig_options); @@ -176,4 +176,5 @@ bool parse_pg_basebackup_options(const char *pg_basebackup_options, /* called by repmgr-client and repmgrd */ void exit_with_cli_errors(ItemList *error_list); void print_item_list(ItemList *item_list); -#endif + +#endif /* _REPMGR_CONFIGFILE_H_ */ diff --git a/repmgr-client.c b/repmgr-client.c index fb8cfabf..92141e06 100644 --- a/repmgr-client.c +++ b/repmgr-client.c @@ -76,8 +76,6 @@ main(int argc, char **argv) int action = NO_ACTION; char *dummy_action = ""; - bool config_file_parsed = false; - set_progname(argv[0]); /* @@ -730,11 +728,11 @@ main(int argc, char **argv) * however if available we'll parse it anyway for options like 'log_level', * 'use_replication_slots' etc. */ - config_file_parsed = load_config(runtime_options.config_file, - runtime_options.verbose, - runtime_options.terse, - &config_file_options, - argv[0]); + load_config(runtime_options.config_file, + runtime_options.verbose, + runtime_options.terse, + &config_file_options, + argv[0]); /* Some configuration file items can be overriden by command line options */ /* Command-line parameter -L/--log-level overrides any setting in config file*/ @@ -1288,6 +1286,7 @@ do_help(void) #endif printf(_(" %s [OPTIONS] bdr register\n"), progname()); printf(_(" %s [OPTIONS] bdr unregister\n"), progname()); + printf(_(" %s [OPTIONS] cluster show\n"), progname()); printf(_(" %s [OPTIONS] cluster event\n"), progname()); puts(""); @@ -1396,6 +1395,7 @@ create_repmgr_extension(PGconn *conn) return true; /* 4. Create extension */ + initPQExpBuffer(&query); wrap_ddl_query(&query, config_file_options.replication_type, @@ -1631,7 +1631,6 @@ get_superuser_connection(PGconn **conn, PGconn **superuser_conn, PGconn **privil return; } - // XXX largely duplicated from create_repmgr_extension() if (runtime_options.superuser[0] == '\0') { log_error(_("\"%s\" is not a superuser and no superuser name supplied"), userinfo.username);