nghttpx: Don't call get_config() repeatedly

This commit is contained in:
Tatsuhiro Tsujikawa 2017-02-16 23:41:23 +09:00
parent 6960039aee
commit 1133cc0bbc
1 changed files with 3 additions and 2 deletions

View File

@ -454,7 +454,8 @@ void exec_binary() {
for (char **p = environ; *p; ++p, ++envlen)
;
auto &listenerconf = get_config()->conn.listener;
auto config = get_config();
auto &listenerconf = config->conn.listener;
// 2 for ENV_ORIG_PID and terminal nullptr.
auto envp = make_unique<char *[]>(envlen + listenerconf.addrs.size() + 2);
@ -482,7 +483,7 @@ void exec_binary() {
auto ipc_fd_str = ENV_ORIG_PID.str();
ipc_fd_str += '=';
ipc_fd_str += util::utos(get_config()->pid);
ipc_fd_str += util::utos(config->pid);
envp[envidx++] = const_cast<char *>(ipc_fd_str.c_str());
for (size_t i = 0; i < envlen; ++i) {