From f669de6d4efaee8834d976d2a34ba73aa16e24d5 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Tue, 21 Jun 2022 16:08:25 -0700 Subject: [PATCH] Remove SString::UIndex and SString::UIterator as they are never used. --- src/coreclr/inc/sstring.h | 52 ------------------ src/coreclr/inc/sstring.inl | 106 ------------------------------------ 2 files changed, 158 deletions(-) diff --git a/src/coreclr/inc/sstring.h b/src/coreclr/inc/sstring.h index 5f5eeb1078e00..691a739b7a345 100644 --- a/src/coreclr/inc/sstring.h +++ b/src/coreclr/inc/sstring.h @@ -105,16 +105,11 @@ class EMPTY_BASES_DECL SString : private SBuffer protected: class Index; - class UIndex; friend class Index; - friend class UIndex; public: - // UIterator is character-level assignable. - class UIterator; - // CIterators/Iterator'string must be modified by SString APIs. class CIterator; class Iterator; @@ -325,53 +320,6 @@ class EMPTY_BASES_DECL SString : private SBuffer // CIterator and Iterator are cheap to create, but allow only read-only // access to the string. // - // UIterator forces a unicode conversion, but allows - // assignment to individual string characters. They are also a bit more - // efficient once created. - - // ------------------------------------------------------------------ - // UIterator: - // ------------------------------------------------------------------ - - protected: - - class EMPTY_BASES_DECL UIndex : public SBuffer::Index - { - friend class SString; - friend class Indexer; - - protected: - - UIndex(); - UIndex(SString *string, SCOUNT_T index); - WCHAR &GetAt(SCOUNT_T delta) const; - void Skip(SCOUNT_T delta); - SCOUNT_T Subtract(const UIndex &i) const; - CHECK DoCheck(SCOUNT_T delta) const; - - WCHAR *GetUnicode() const; - }; - - public: - - class EMPTY_BASES_DECL UIterator : public UIndex, public Indexer - { - friend class SString; - - public: - UIterator() - { - } - - UIterator(SString *string, int index) - : UIndex(string, index) - { - } - }; - - UIterator BeginUnicode(); - UIterator EndUnicode(); - // For CIterator & Iterator, we try our best to iterate the string without // modifying it. (Currently, we do require an ASCII or Unicode string // for simple WCHAR retrival, but you could imagine being more flexible diff --git a/src/coreclr/inc/sstring.inl b/src/coreclr/inc/sstring.inl index 03fc26fe9666c..eeb35d9c8041e 100644 --- a/src/coreclr/inc/sstring.inl +++ b/src/coreclr/inc/sstring.inl @@ -1906,44 +1906,6 @@ inline void SString::ConvertToIteratable() const SS_RETURN; } -//----------------------------------------------------------------------------- -// Create iterators on the string. -//----------------------------------------------------------------------------- - -inline SString::UIterator SString::BeginUnicode() -{ - SS_CONTRACT(SString::UIterator) - { - GC_NOTRIGGER; - PRECONDITION(CheckPointer(this)); - SS_POSTCONDITION(CheckValue(RETVAL)); - THROWS; - } - SS_CONTRACT_END; - - ConvertToUnicode(); - EnsureWritable(); - - SS_RETURN UIterator(this, 0); -} - -inline SString::UIterator SString::EndUnicode() -{ - SS_CONTRACT(SString::UIterator) - { - GC_NOTRIGGER; - PRECONDITION(CheckPointer(this)); - SS_POSTCONDITION(CheckValue(RETVAL)); - THROWS; - } - SS_CONTRACT_END; - - ConvertToUnicode(); - EnsureWritable(); - - SS_RETURN UIterator(this, GetCount()); -} - //----------------------------------------------------------------------------- // Create CIterators on the string. //----------------------------------------------------------------------------- @@ -2135,74 +2097,6 @@ inline WCHAR SString::Index::operator[](int index) const return *(WCHAR*)&GetAt(index); } -//----------------------------------------------------------------------------- -// Iterator support routines -//----------------------------------------------------------------------------- - -inline SString::UIndex::UIndex() -{ - LIMITED_METHOD_CONTRACT; -} - -inline SString::UIndex::UIndex(SString *string, SCOUNT_T index) - : SBuffer::Index(string, index*sizeof(WCHAR)) -{ - SS_CONTRACT_VOID - { - GC_NOTRIGGER; - PRECONDITION(CheckPointer(string)); - PRECONDITION(string->IsRepresentation(REPRESENTATION_UNICODE)); - PRECONDITION(DoCheck(0)); - SS_POSTCONDITION(CheckPointer(this)); - NOTHROW; - CANNOT_TAKE_LOCK; - } - SS_CONTRACT_END; - - SS_RETURN; -} - -inline WCHAR &SString::UIndex::GetAt(SCOUNT_T delta) const -{ - LIMITED_METHOD_CONTRACT; - - return ((WCHAR*)m_ptr)[delta]; -} - -inline void SString::UIndex::Skip(SCOUNT_T delta) -{ - LIMITED_METHOD_CONTRACT; - - m_ptr += delta * sizeof(WCHAR); -} - -inline SCOUNT_T SString::UIndex::Subtract(const UIndex &i) const -{ - WRAPPER_NO_CONTRACT; - - return (SCOUNT_T) (GetUnicode() - i.GetUnicode()); -} - -inline CHECK SString::UIndex::DoCheck(SCOUNT_T delta) const -{ - CANNOT_HAVE_CONTRACT; -#if _DEBUG - const SString *string = (const SString *) GetContainerDebug(); - - CHECK(GetUnicode() + delta >= string->GetRawUnicode()); - CHECK(GetUnicode() + delta <= string->GetRawUnicode() + string->GetCount()); -#endif - - CHECK_OK; -} - -inline WCHAR *SString::UIndex::GetUnicode() const -{ - LIMITED_METHOD_CONTRACT; - - return (WCHAR*) m_ptr; -} - //----------------------------------------------------------------------------- // Opaque scratch buffer class routines //-----------------------------------------------------------------------------