Skip to content

Commit db2de58

Browse files
author
Lance Parker
committed
Remove unecessary unicode collation algorithm shims
1 parent 49bc145 commit db2de58

File tree

2 files changed

+0
-91
lines changed

2 files changed

+0
-91
lines changed

stdlib/public/SwiftShims/UnicodeShims.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,6 @@ SWIFT_RUNTIME_STDLIB_INTERFACE
6262
const __swift_uint16_t *
6363
_swift_stdlib_ExtendedGraphemeClusterNoBoundaryRulesMatrix;
6464

65-
SWIFT_RUNTIME_STDLIB_INTERFACE
66-
SWIFT_READONLY __swift_int32_t
67-
_swift_stdlib_unicode_compare_utf16_utf16(const __swift_uint16_t *Left,
68-
__swift_int32_t LeftLength,
69-
const __swift_uint16_t *Right,
70-
__swift_int32_t RightLength);
71-
72-
SWIFT_RUNTIME_STDLIB_INTERFACE
73-
SWIFT_READONLY __swift_int32_t
74-
_swift_stdlib_unicode_compare_utf8_utf16(const unsigned char *Left,
75-
__swift_int32_t LeftLength,
76-
const __swift_uint16_t *Right,
77-
__swift_int32_t RightLength);
78-
79-
SWIFT_RUNTIME_STDLIB_INTERFACE
80-
SWIFT_READONLY __swift_int32_t
81-
_swift_stdlib_unicode_compare_utf8_utf8(const unsigned char *Left,
82-
__swift_int32_t LeftLength,
83-
const unsigned char *Right,
84-
__swift_int32_t RightLength);
85-
8665
SWIFT_RUNTIME_STDLIB_INTERFACE
8766
void *_swift_stdlib_unicodeCollationIterator_create(
8867
const __swift_uint16_t *Str,

stdlib/public/stubs/UnicodeNormalization.cpp

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -155,76 +155,6 @@ class ASCIICollation {
155155
ASCIICollation(const ASCIICollation &) = delete;
156156
};
157157

158-
/// Compares the strings via the Unicode Collation Algorithm on the root locale.
159-
/// Results are the usual string comparison results:
160-
/// <0 the left string is less than the right string.
161-
/// ==0 the strings are equal according to their collation.
162-
/// >0 the left string is greater than the right string.
163-
int32_t
164-
swift::_swift_stdlib_unicode_compare_utf16_utf16(const uint16_t *LeftString,
165-
int32_t LeftLength,
166-
const uint16_t *RightString,
167-
int32_t RightLength) {
168-
// ICU UChar type is platform dependent. In Cygwin, it is defined
169-
// as wchar_t which size is 2. It seems that the underlying binary
170-
// representation is same with swift utf16 representation.
171-
// On Clang 4.0 under a recent Linux, ICU uses the built-in char16_t type.
172-
return ucol_strcoll(GetRootCollator(),
173-
reinterpret_cast<const UChar *>(LeftString), LeftLength,
174-
reinterpret_cast<const UChar *>(RightString), RightLength);
175-
}
176-
177-
/// Compares the strings via the Unicode Collation Algorithm on the root locale.
178-
/// Results are the usual string comparison results:
179-
/// <0 the left string is less than the right string.
180-
/// ==0 the strings are equal according to their collation.
181-
/// >0 the left string is greater than the right string.
182-
int32_t
183-
swift::_swift_stdlib_unicode_compare_utf8_utf16(const unsigned char *LeftString,
184-
int32_t LeftLength,
185-
const uint16_t *RightString,
186-
int32_t RightLength) {
187-
UCharIterator LeftIterator;
188-
UCharIterator RightIterator;
189-
UErrorCode ErrorCode = U_ZERO_ERROR;
190-
191-
uiter_setUTF8(&LeftIterator, reinterpret_cast<const char *>(LeftString), LeftLength);
192-
uiter_setString(&RightIterator, reinterpret_cast<const UChar *>(RightString),
193-
RightLength);
194-
195-
uint32_t Diff = ucol_strcollIter(GetRootCollator(),
196-
&LeftIterator, &RightIterator, &ErrorCode);
197-
if (U_FAILURE(ErrorCode)) {
198-
swift::crash("ucol_strcollIter: Unexpected error doing utf8<->utf16 string comparison.");
199-
}
200-
return Diff;
201-
}
202-
203-
/// Compares the strings via the Unicode Collation Algorithm on the root locale.
204-
/// Results are the usual string comparison results:
205-
/// <0 the left string is less than the right string.
206-
/// ==0 the strings are equal according to their collation.
207-
/// >0 the left string is greater than the right string.
208-
int32_t
209-
swift::_swift_stdlib_unicode_compare_utf8_utf8(const unsigned char *LeftString,
210-
int32_t LeftLength,
211-
const unsigned char *RightString,
212-
int32_t RightLength) {
213-
UCharIterator LeftIterator;
214-
UCharIterator RightIterator;
215-
UErrorCode ErrorCode = U_ZERO_ERROR;
216-
217-
uiter_setUTF8(&LeftIterator, reinterpret_cast<const char *>(LeftString), LeftLength);
218-
uiter_setUTF8(&RightIterator, reinterpret_cast<const char *>(RightString), RightLength);
219-
220-
uint32_t Diff = ucol_strcollIter(GetRootCollator(),
221-
&LeftIterator, &RightIterator, &ErrorCode);
222-
if (U_FAILURE(ErrorCode)) {
223-
swift::crash("ucol_strcollIter: Unexpected error doing utf8<->utf8 string comparison.");
224-
}
225-
return Diff;
226-
}
227-
228158
void *swift::_swift_stdlib_unicodeCollationIterator_create(
229159
const __swift_uint16_t *Str, __swift_uint32_t Length) {
230160
UErrorCode ErrorCode = U_ZERO_ERROR;

0 commit comments

Comments
 (0)