nghttpx: Use ImmutableString for conf_path

This commit is contained in:
Tatsuhiro Tsujikawa 2016-02-14 22:20:10 +09:00
parent 76a425226f
commit 466e4b7a1e
2 changed files with 7 additions and 7 deletions

View File

@ -1040,7 +1040,7 @@ void fill_default_config() {
*mod_config() = {}; *mod_config() = {};
mod_config()->num_worker = 1; mod_config()->num_worker = 1;
mod_config()->conf_path = strcopy("/etc/nghttpx/nghttpx.conf"); mod_config()->conf_path = "/etc/nghttpx/nghttpx.conf";
mod_config()->pid = getpid(); mod_config()->pid = getpid();
auto &tlsconf = mod_config()->tls; auto &tlsconf = mod_config()->tls;
@ -1893,7 +1893,7 @@ Scripting:
Misc: Misc:
--conf=<PATH> --conf=<PATH>
Load configuration from <PATH>. Load configuration from <PATH>.
Default: )" << get_config()->conf_path.get() << R"( Default: )" << get_config()->conf_path << R"(
--include=<PATH> --include=<PATH>
Load additional configurations from <PATH>. File <PATH> Load additional configurations from <PATH>. File <PATH>
is read when configuration parser encountered this is read when configuration parser encountered this
@ -1919,11 +1919,11 @@ namespace {
void process_options( void process_options(
int argc, char **argv, int argc, char **argv,
std::vector<std::pair<const char *, const char *>> &cmdcfgs) { std::vector<std::pair<const char *, const char *>> &cmdcfgs) {
if (conf_exists(get_config()->conf_path.get())) { if (conf_exists(get_config()->conf_path.c_str())) {
std::set<std::string> include_set; std::set<std::string> include_set;
if (load_config(get_config()->conf_path.get(), include_set) == -1) { if (load_config(get_config()->conf_path.c_str(), include_set) == -1) {
LOG(FATAL) << "Failed to load configuration from " LOG(FATAL) << "Failed to load configuration from "
<< get_config()->conf_path.get(); << get_config()->conf_path;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
assert(include_set.empty()); assert(include_set.empty());
@ -2563,7 +2563,7 @@ int main(int argc, char **argv) {
break; break;
case 12: case 12:
// --conf // --conf
mod_config()->conf_path = strcopy(optarg); mod_config()->conf_path = optarg;
break; break;
case 14: case 14:
// --syslog-facility // --syslog-facility

View File

@ -582,7 +582,7 @@ struct Config {
LoggingConfig logging; LoggingConfig logging;
ConnectionConfig conn; ConnectionConfig conn;
ImmutableString pid_file; ImmutableString pid_file;
std::unique_ptr<char[]> conf_path; ImmutableString conf_path;
std::unique_ptr<char[]> user; std::unique_ptr<char[]> user;
std::unique_ptr<char[]> mruby_file; std::unique_ptr<char[]> mruby_file;
char **original_argv; char **original_argv;