Skip to content

Commit c39fe2d

Browse files
authored
_FoundationCShims: enable building on Android (#703)
The `strncasecmp_l` was added at API level 23. For now, simply abort on older releases, though we should consider shimming the path.
1 parent 131d89f commit c39fe2d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/_FoundationCShims/string_shims.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,17 @@ int _stringshims_strncasecmp_l(const char * _Nullable s1,
3838
return _strnicmp_l(s1, s2, n, loc ? loc : *cloc);
3939
#else
4040
if (loc != NULL) {
41-
#if defined(TARGET_OS_EXCLAVEKIT) && TARGET_OS_EXCLAVEKIT
41+
#if (defined(TARGET_OS_EXCLAVEKIT) && TARGET_OS_EXCLAVEKIT) || \
42+
(defined(TARGET_OS_ANDROID) && TARGET_OS_ANDROID && __ANDROID_API__ < 23)
4243
abort();
4344
#else
4445
return strncasecmp_l(s1, s2, n, loc);
4546
#endif
4647
}
4748
// On Darwin, NULL loc means unlocalized compare.
4849
// Uses the standard C locale for Linux in this case
49-
#if defined(TARGET_OS_EXCLAVEKIT) && TARGET_OS_EXCLAVEKIT
50+
#if (defined(TARGET_OS_EXCLAVEKIT) && TARGET_OS_EXCLAVEKIT) || \
51+
(defined(TARGET_OS_ANDROID) && TARGET_OS_ANDROID && __ANDROID_API__ < 23)
5052
return strncasecmp(s1, s2, n);
5153
#elif TARGET_OS_MAC
5254
return strncasecmp_l(s1, s2, n, NULL);

0 commit comments

Comments
 (0)