From 5e05584708379d05d303441a78dae46120dd7281 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Tue, 21 Dec 2021 09:42:13 +1000 Subject: [PATCH] uri: change `clear` into `clear_fragment` --- uri.cpp | 14 ++++++-------- uri.hpp | 3 ++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/uri.cpp b/uri.cpp index d7bab44b..9bb2bf8a 100644 --- a/uri.cpp +++ b/uri.cpp @@ -128,18 +128,16 @@ uri::set (component c, std::string_view val) //----------------------------------------------------------------------------- -void uri::clear (component const c) +void uri::clear_fragment () { - auto const offset = m_views[c].size (); - for (int i = c + 1; i < component::NUM_COMPONENTS; ++i) - m_views[i] -= offset; + if (!m_views[FRAGMENT]) + return; m_value.erase ( - m_views[c].begin () - m_value.data (), - m_views[c].size () + m_views[FRAGMENT].begin () - m_value.data (), + m_views[FRAGMENT].size () ); - - m_views[c] = nullptr; + m_views[FRAGMENT] = nullptr; } diff --git a/uri.hpp b/uri.hpp index 68d764f0..84eebf68 100644 --- a/uri.hpp +++ b/uri.hpp @@ -100,7 +100,8 @@ namespace cruft { std::string_view query (void) const& { return get (QUERY); } std::string_view fragment (void) const& { return get (FRAGMENT); } - void clear (component); + // void clear (component); + void clear_fragment (void); auto components (void) const& noexcept { return m_views; }