From 7d61dc4441828469a2446131f8b0f887ad66e6b7 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 16 Sep 2017 11:51:52 -0700 Subject: [PATCH] ircd::db: Reflect with string_view. --- include/ircd/db.h | 2 ++ ircd/db.cc | 15 +++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/ircd/db.h b/include/ircd/db.h index 716875437..24938765f 100644 --- a/include/ircd/db.h +++ b/include/ircd/db.h @@ -98,6 +98,8 @@ namespace ircd::db std::vector available(); void log_rdb_perf_context(const bool &all = true); + + string_view reflect(const pos &); } enum class ircd::db::pos diff --git a/ircd/db.cc b/ircd/db.cc index 2f02913d3..3535de414 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -46,7 +46,6 @@ namespace ircd::db throw_on_error(const rocksdb::Status & = rocksdb::Status::OK()); }; - const char *reflect(const pos &); const std::string &reflect(const rocksdb::Tickers &); const std::string &reflect(const rocksdb::Histograms &); rocksdb::Slice slice(const string_view &); @@ -3203,19 +3202,19 @@ ircd::db::reflect(const rocksdb::Histograms &type) return it != end(names)? it->second : empty; } -const char * +ircd::string_view ircd::db::reflect(const pos &pos) { switch(pos) { - case pos::NEXT: return "NEXT"; - case pos::PREV: return "PREV"; - case pos::FRONT: return "FRONT"; - case pos::BACK: return "BACK"; - case pos::END: return "END"; + case pos::NEXT: return "NEXT"s; + case pos::PREV: return "PREV"s; + case pos::FRONT: return "FRONT"s; + case pos::BACK: return "BACK"s; + case pos::END: return "END"s; } - return "?????"; + return "?????"s; } bool