]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: return string_view for type 26434/head
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 14 Feb 2019 20:27:11 +0000 (12:27 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Thu, 14 Feb 2019 21:50:12 +0000 (13:50 -0800)
To avoid unnecessary heap allocation.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/LogEvent.cc
src/mds/LogEvent.h

index bafe4b4fbd5ea0d527da5a83aa03d2bb82f26cf7..3e321531a0c9e6a7762f8be3ab9816220c66d50b 100644 (file)
@@ -67,7 +67,7 @@ std::unique_ptr<LogEvent> 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";
index 73e2438f6273f981710d8e154d38c9c08dde84c3..7c7273f8f986da8a752affd4ec247fa2c04d1692 100644 (file)
@@ -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; }