From 5b94b7315223bb30709700f886c8de9771f5657a Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 20 Dec 2014 18:40:17 +0000 Subject: [PATCH] Small code tweak --- src/client.cc | 5 ++--- src/client.hh | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/client.cc b/src/client.cc index 69e1aaea..d2cf5e96 100644 --- a/src/client.cc +++ b/src/client.cc @@ -227,12 +227,11 @@ void Client::check_buffer_fs_timestamp() reload_buffer(context(), filename); } -const String& Client::get_env_var(const String& name) const +StringView Client::get_env_var(const String& name) const { auto it = m_env_vars.find(name); - static String empty{}; if (it == m_env_vars.end()) - return empty; + return {}; return it->second; } diff --git a/src/client.hh b/src/client.hh index 42e5dd9f..6beb61f4 100644 --- a/src/client.hh +++ b/src/client.hh @@ -50,7 +50,7 @@ public: void change_buffer(Buffer& buffer); - const String& get_env_var(const String& name) const; + StringView get_env_var(const String& name) const; private: void on_option_changed(const Option& option) override;