Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove SString::UIndex and SString::UIterator as they are never used. #71103

Merged
merged 1 commit into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions src/coreclr/inc/sstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<WCHAR, UIterator>;

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<WCHAR, UIterator>
{
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
Expand Down
106 changes: 0 additions & 106 deletions src/coreclr/inc/sstring.inl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -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
//-----------------------------------------------------------------------------
Expand Down