From: Patrick Donnelly Date: Thu, 14 Feb 2019 20:27:11 +0000 (-0800) Subject: mds: return string_view for type X-Git-Tag: v14.1.0~99^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F26434%2Fhead;p=ceph.git mds: return string_view for type To avoid unnecessary heap allocation. Signed-off-by: Patrick Donnelly --- diff --git a/src/mds/LogEvent.cc b/src/mds/LogEvent.cc index bafe4b4fbd5..3e321531a0c 100644 --- a/src/mds/LogEvent.cc +++ b/src/mds/LogEvent.cc @@ -67,7 +67,7 @@ std::unique_ptr LogEvent::decode_event(bufferlist::const_iterator p) } -std::string LogEvent::get_type_str() const +std::string_view LogEvent::get_type_str() const { switch(_type) { case EVENT_SUBTREEMAP: return "SUBTREEMAP"; diff --git a/src/mds/LogEvent.h b/src/mds/LogEvent.h index 73e2438f627..7c7273f8f98 100644 --- a/src/mds/LogEvent.h +++ b/src/mds/LogEvent.h @@ -62,7 +62,7 @@ public: LogEvent& operator=(const LogEvent&) = delete; virtual ~LogEvent() {} - string get_type_str() const; + std::string_view get_type_str() const; static EventType str_to_type(std::string_view str); EventType get_type() const { return _type; } void set_type(EventType t) { _type = t; }