diff options
-rw-r--r-- | liblog/event_tag_map.cpp | 9 | ||||
-rw-r--r-- | logd/LogStatistics.h | 21 |
2 files changed, 14 insertions, 16 deletions
diff --git a/liblog/event_tag_map.cpp b/liblog/event_tag_map.cpp index 83064fde3..2e2bf8734 100644 --- a/liblog/event_tag_map.cpp +++ b/liblog/event_tag_map.cpp @@ -25,9 +25,9 @@ #include <string.h> #include <sys/mman.h> -#include <experimental/string_view> #include <functional> #include <string> +#include <string_view> #include <unordered_map> #include <log/event_tag_map.h> @@ -44,10 +44,10 @@ class MapString { private: const std::string* alloc; // HAS-AN - const std::experimental::string_view str; // HAS-A + const std::string_view str; // HAS-A public: - operator const std::experimental::string_view() const { + operator const std::string_view() const { return str; } @@ -92,8 +92,7 @@ struct std::hash<MapString> : public std::unary_function<const MapString&, size_t> { size_t operator()(const MapString& __t) const noexcept { if (!__t.length()) return 0; - return std::hash<std::experimental::string_view>()( - std::experimental::string_view(__t)); + return std::hash<std::string_view>()(std::string_view(__t)); } }; diff --git a/logd/LogStatistics.h b/logd/LogStatistics.h index 8808aac70..ac3cf9af2 100644 --- a/logd/LogStatistics.h +++ b/logd/LogStatistics.h @@ -25,9 +25,9 @@ #include <sys/types.h> #include <algorithm> // std::max -#include <experimental/string_view> #include <memory> -#include <string> // std::string +#include <string> +#include <string_view> #include <unordered_map> #include <android-base/stringprintf.h> @@ -495,7 +495,7 @@ struct TagEntry : public EntryBaseDropped { struct TagNameKey { std::string* alloc; - std::experimental::string_view name; // Saves space if const char* + std::string_view name; // Saves space if const char* explicit TagNameKey(const LogBufferElement* element) : alloc(nullptr), name("", strlen("")) { @@ -504,31 +504,31 @@ struct TagNameKey { if (tag) { const char* cp = android::tagToName(tag); if (cp) { - name = std::experimental::string_view(cp, strlen(cp)); + name = std::string_view(cp, strlen(cp)); return; } } alloc = new std::string( android::base::StringPrintf("[%" PRIu32 "]", tag)); if (!alloc) return; - name = std::experimental::string_view(alloc->c_str(), alloc->size()); + name = std::string_view(alloc->c_str(), alloc->size()); return; } const char* msg = element->getMsg(); if (!msg) { - name = std::experimental::string_view("chatty", strlen("chatty")); + name = std::string_view("chatty", strlen("chatty")); return; } ++msg; unsigned short len = element->getMsgLen(); len = (len <= 1) ? 0 : strnlen(msg, len - 1); if (!len) { - name = std::experimental::string_view("<NULL>", strlen("<NULL>")); + name = std::string_view("<NULL>", strlen("<NULL>")); return; } alloc = new std::string(msg, len); if (!alloc) return; - name = std::experimental::string_view(alloc->c_str(), alloc->size()); + name = std::string_view(alloc->c_str(), alloc->size()); } explicit TagNameKey(TagNameKey&& rval) @@ -545,7 +545,7 @@ struct TagNameKey { if (alloc) delete alloc; } - operator const std::experimental::string_view() const { + operator const std::string_view() const { return name; } @@ -576,8 +576,7 @@ struct std::hash<TagNameKey> : public std::unary_function<const TagNameKey&, size_t> { size_t operator()(const TagNameKey& __t) const noexcept { if (!__t.length()) return 0; - return std::hash<std::experimental::string_view>()( - std::experimental::string_view(__t)); + return std::hash<std::string_view>()(std::string_view(__t)); } }; |