From c929684e336ca7657a1dd787efaa1bea12c3286f Mon Sep 17 00:00:00 2001 From: Christopher Di Bella Date: Sat, 1 Jun 2019 14:57:06 +0100 Subject: [PATCH] inlines count_code_points(basic_string_view) was defined in fmt/format-inl.h, and only declared in fmt/format.h, but not defined in src/format.cc. This commit moves the overload to fmt/format.h and inlines it. --- include/fmt/format-inl.h | 9 --------- include/fmt/format.h | 9 ++++++++- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 8f9d58f7b40e..24c6c77bcdcd 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -200,15 +200,6 @@ void report_error(FormatFunc func, int error_code, } } // namespace -FMT_FUNC size_t internal::count_code_points(basic_string_view s) { - const char8_t* data = s.data(); - size_t num_code_points = 0; - for (size_t i = 0, size = s.size(); i != size; ++i) { - if ((data[i] & 0xc0) != 0x80) ++num_code_points; - } - return num_code_points; -} - #if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) namespace internal { diff --git a/include/fmt/format.h b/include/fmt/format.h index 72be49bc2072..7e4cf3be9044 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -766,7 +766,14 @@ inline size_t count_code_points(basic_string_view s) { } // Counts the number of code points in a UTF-8 string. -FMT_API size_t count_code_points(basic_string_view s); +inline size_t count_code_points(basic_string_view s) { + const char8_t* data = s.data(); + size_t num_code_points = 0; + for (size_t i = 0, size = s.size(); i != size; ++i) { + if ((data[i] & 0xc0) != 0x80) ++num_code_points; + } + return num_code_points; +} inline char8_t to_char8_t(char c) { return static_cast(c); }