File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -1206,13 +1206,7 @@ public:
12061206 }
12071207# endif // _LIBCPP_CXX03_LANG
12081208
1209- inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string () {
1210- // We do not use __reset_internal_buffer() here to avoid the overhead of
1211- // resetting the object.
1212- __annotate_delete ();
1213- if (__is_long ())
1214- __alloc_traits::deallocate (__alloc_, __get_long_pointer (), __get_long_cap ());
1215- }
1209+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string () { __deallocate_buffer_if_long (); }
12161210
12171211 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator __self_view () const _NOEXCEPT {
12181212 return __self_view (typename __self_view::__assume_valid (), data (), size ());
@@ -2265,11 +2259,15 @@ private:
22652259 return __long (__buffer, __capacity);
22662260 }
22672261
2268- // Deallocate the long buffer if it exists and clear the short buffer so we are an empty string
2269- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __reset_internal_buffer () {
2262+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __deallocate_buffer_if_long () {
22702263 __annotate_delete ();
22712264 if (__is_long ())
22722265 __alloc_traits::deallocate (__alloc_, __get_long_pointer (), __get_long_cap ());
2266+ }
2267+
2268+ // Deallocate the long buffer if it exists and clear the short buffer so we are an empty string
2269+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __reset_internal_buffer () {
2270+ __deallocate_buffer_if_long ();
22732271 __rep_.__s = __short ();
22742272 }
22752273
You can’t perform that action at this time.
0 commit comments