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 #include -#include #include #include +#include #include #include @@ -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 : public std::unary_function { size_t operator()(const MapString& __t) const noexcept { if (!__t.length()) return 0; - return std::hash()( - std::experimental::string_view(__t)); + return std::hash()(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 #include // std::max -#include #include -#include // std::string +#include +#include #include #include @@ -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("", strlen("")); + name = std::string_view("", strlen("")); 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 : public std::unary_function { size_t operator()(const TagNameKey& __t) const noexcept { if (!__t.length()) return 0; - return std::hash()( - std::experimental::string_view(__t)); + return std::hash()(std::string_view(__t)); } };