shrpx: Remove Config ctor and fill all initial values in fill_default_config()

This commit is contained in:
Tatsuhiro Tsujikawa 2012-11-22 23:35:10 +09:00
parent c1332a35a5
commit 7a21905312
3 changed files with 10 additions and 46 deletions

View File

@ -296,7 +296,11 @@ bool conf_exists(const char *path)
namespace { namespace {
void fill_default_config() void fill_default_config()
{ {
memset(mod_config(), 0, sizeof(*mod_config()));
mod_config()->verbose = false;
mod_config()->daemon = false; mod_config()->daemon = false;
mod_config()->verify_client = false;
mod_config()->server_name = "shrpx spdylay/"SPDYLAY_VERSION; mod_config()->server_name = "shrpx spdylay/"SPDYLAY_VERSION;
set_config_str(&mod_config()->host, "0.0.0.0"); set_config_str(&mod_config()->host, "0.0.0.0");
@ -332,33 +336,30 @@ void fill_default_config()
set_config_str(&mod_config()->downstream_host, "127.0.0.1"); set_config_str(&mod_config()->downstream_host, "127.0.0.1");
mod_config()->downstream_port = 80; mod_config()->downstream_port = 80;
mod_config()->downstream_hostport = 0;
mod_config()->downstream_addrlen = 0;
mod_config()->num_worker = 1; mod_config()->num_worker = 1;
mod_config()->spdy_max_concurrent_streams = mod_config()->spdy_max_concurrent_streams =
SPDYLAY_INITIAL_MAX_CONCURRENT_STREAMS; SPDYLAY_INITIAL_MAX_CONCURRENT_STREAMS;
mod_config()->spdy_proxy = false;
mod_config()->add_x_forwarded_for = false; mod_config()->add_x_forwarded_for = false;
mod_config()->accesslog = false; mod_config()->accesslog = false;
set_config_str(&mod_config()->conf_path, "/etc/shrpx/shrpx.conf"); set_config_str(&mod_config()->conf_path, "/etc/shrpx/shrpx.conf");
mod_config()->syslog = false; mod_config()->syslog = false;
mod_config()->syslog_facility = LOG_DAEMON; mod_config()->syslog_facility = LOG_DAEMON;
mod_config()->use_syslog = false; mod_config()->use_syslog = false;
// Default accept() backlog // Default accept() backlog
mod_config()->backlog = 256; mod_config()->backlog = 256;
mod_config()->ciphers = 0; mod_config()->ciphers = 0;
mod_config()->spdy_proxy = false;
mod_config()->client_proxy = false; mod_config()->client_proxy = false;
mod_config()->client = false; mod_config()->client = false;
mod_config()->client_mode = false; mod_config()->client_mode = false;
mod_config()->insecure = false; mod_config()->insecure = false;
mod_config()->cacert = 0; mod_config()->cacert = 0;
mod_config()->pid_file = 0;
mod_config()->uid = 0;
mod_config()->gid = 0;
} }
} // namespace } // namespace

View File

@ -74,42 +74,6 @@ const char SHRPX_OPT_CLIENT[] = "client";
const char SHRPX_OPT_INSECURE[] = "insecure"; const char SHRPX_OPT_INSECURE[] = "insecure";
const char SHRPX_OPT_CACERT[] = "cacert"; const char SHRPX_OPT_CACERT[] = "cacert";
Config::Config()
: verbose(false),
daemon(false),
host(0),
port(0),
private_key_file(0),
cert_file(0),
verify_client(false),
server_name(0),
downstream_host(0),
downstream_port(0),
downstream_hostport(0),
downstream_addrlen(0),
num_worker(0),
spdy_max_concurrent_streams(0),
spdy_proxy(false),
client_proxy(false),
add_x_forwarded_for(false),
accesslog(false),
spdy_upstream_window_bits(0),
spdy_downstream_window_bits(0),
pid_file(0),
uid(0),
gid(0),
conf_path(0),
syslog(false),
syslog_facility(0),
use_syslog(false),
backlog(0),
ciphers(0),
client(false),
client_mode(false),
insecure(false),
cacert(0)
{}
namespace { namespace {
Config *config = 0; Config *config = 0;
} // namespace } // namespace

View File

@ -116,7 +116,6 @@ struct Config {
bool client_mode; bool client_mode;
bool insecure; bool insecure;
char *cacert; char *cacert;
Config();
}; };
const Config* get_config(); const Config* get_config();