From 1133cc0bbc11aa9b886011c5b9d9199261e4ad77 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 16 Feb 2017 23:41:23 +0900 Subject: [PATCH] nghttpx: Don't call get_config() repeatedly --- src/shrpx.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shrpx.cc b/src/shrpx.cc index 091ec708..6fddd4d3 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -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(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(ipc_fd_str.c_str()); for (size_t i = 0; i < envlen; ++i) {