Skip to content

Commit

Permalink
src/shrpx_config.cc: Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuhiro-t committed Oct 2, 2013
1 parent d90e0d4 commit c7ce6d8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/shrpx_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const char SHRPX_OPT_WRITE_BURST[] = "write-burst";
const char SHRPX_OPT_NPN_LIST[] = "npn-list";

namespace {
Config *config = 0;
Config *config = nullptr;
} // namespace

const Config* get_config()
Expand Down Expand Up @@ -308,8 +308,8 @@ int parse_config(const char *opt, const char *optarg)
} else if(util::strieq(opt, SHRPX_OPT_PID_FILE)) {
set_config_str(&mod_config()->pid_file, optarg);
} else if(util::strieq(opt, SHRPX_OPT_USER)) {
passwd *pwd = getpwnam(optarg);
if(pwd == 0) {
auto pwd = getpwnam(optarg);
if(!pwd) {
LOG(ERROR) << "--user: failed to get uid from " << optarg
<< ": " << strerror(errno);
return -1;
Expand All @@ -319,7 +319,7 @@ int parse_config(const char *opt, const char *optarg)
} else if(util::strieq(opt, SHRPX_OPT_PRIVATE_KEY_FILE)) {
set_config_str(&mod_config()->private_key_file, optarg);
} else if(util::strieq(opt, SHRPX_OPT_PRIVATE_KEY_PASSWD_FILE)) {
std::string passwd = read_passwd_from_file(optarg);
auto passwd = read_passwd_from_file(optarg);
if (passwd.empty()) {
LOG(ERROR) << "Couldn't read key file's passwd from " << optarg;
return -1;
Expand All @@ -335,7 +335,7 @@ int parse_config(const char *opt, const char *optarg)
if(sp) {
std::string keyfile(optarg, sp);
// TODO Do we need private key for subcert?
SSL_CTX *ssl_ctx = ssl::create_ssl_context(keyfile.c_str(), sp+1);
auto ssl_ctx = ssl::create_ssl_context(keyfile.c_str(), sp+1);
if(!get_config()->cert_tree) {
mod_config()->cert_tree = ssl::cert_lookup_tree_new();
}
Expand Down Expand Up @@ -444,7 +444,7 @@ int load_config(const char *filename)
return -1;
}
line[i] = '\0';
const char *s = line.c_str();
auto s = line.c_str();
if(parse_config(s, s+i+1) == -1) {
return -1;
}
Expand Down

0 comments on commit c7ce6d8

Please sign in to comment.