Miscellaneous code cleanup

This commit is contained in:
Ian Barwick
2017-07-20 09:11:38 +09:00
parent 8dcfbfc313
commit 38730033d4
3 changed files with 17 additions and 15 deletions

View File

@@ -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;
}

View File

@@ -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_ */

View File

@@ -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);