ICU-22696 Delete unused code.

These optional output parameters weren't used when these function were
originally added so they were most likely included just in case someone
would want to use them in the future, but that was 10 years ago now and
they still haven't been used yet, so it's unlikely that they'll be used
in the foreseeable future and call sites as well as the implementation
can instead be simplified by removing them.
This commit is contained in:
Fredrik Roubert 2024-07-18 20:59:42 +02:00 committed by Fredrik Roubert
parent 06c077bd35
commit 5d7cbdbc02
4 changed files with 7 additions and 33 deletions

View file

@ -1570,7 +1570,7 @@ AliasReplacer::replaceTransformedExtensions(
// Split the "tkey-tvalue" pair string so that we can canonicalize the tvalue.
*const_cast<char*>(tvalue++) = '\0'; // NUL terminate tkey
output.append(tfield, status).append('-', status);
const char* bcpTValue = ulocimp_toBcpType(tfield, tvalue, nullptr, nullptr);
const char* bcpTValue = ulocimp_toBcpType(tfield, tvalue);
output.append((bcpTValue == nullptr) ? tvalue : bcpTValue, status);
}
}

View file

@ -2296,7 +2296,7 @@ uloc_toUnicodeLocaleKey(const char* keyword)
U_CAPI const char* U_EXPORT2
uloc_toUnicodeLocaleType(const char* keyword, const char* value)
{
const char* bcpType = ulocimp_toBcpType(keyword, value, nullptr, nullptr);
const char* bcpType = ulocimp_toBcpType(keyword, value);
if (bcpType == nullptr && ultag_isUnicodeLocaleType(value, -1)) {
// unknown keyword, but syntax is fine..
return value;
@ -2364,7 +2364,7 @@ uloc_toLegacyKey(const char* keyword)
U_CAPI const char* U_EXPORT2
uloc_toLegacyType(const char* keyword, const char* value)
{
const char* legacyType = ulocimp_toLegacyType(keyword, value, nullptr, nullptr);
const char* legacyType = ulocimp_toLegacyType(keyword, value);
if (legacyType == nullptr) {
// Checks if the specified locale type is well-formed with the legacy locale syntax.
//

View file

@ -449,23 +449,13 @@ ulocimp_toLegacyKey(const char* key) {
}
U_EXPORT const char*
ulocimp_toBcpType(const char* key, const char* type, bool* isKnownKey, bool* isSpecialType) {
if (isKnownKey != nullptr) {
*isKnownKey = false;
}
if (isSpecialType != nullptr) {
*isSpecialType = false;
}
ulocimp_toBcpType(const char* key, const char* type) {
if (!init()) {
return nullptr;
}
LocExtKeyData* keyData = static_cast<LocExtKeyData*>(uhash_get(gLocExtKeyMap, key));
if (keyData != nullptr) {
if (isKnownKey != nullptr) {
*isKnownKey = true;
}
LocExtType* t = static_cast<LocExtType*>(uhash_get(keyData->typeMap.getAlias(), type));
if (t != nullptr) {
return t->bcpId;
@ -482,9 +472,6 @@ ulocimp_toBcpType(const char* key, const char* type, bool* isKnownKey, bool* isS
matched = isSpecialTypeRgKeyValue(type);
}
if (matched) {
if (isSpecialType != nullptr) {
*isSpecialType = true;
}
return type;
}
}
@ -494,23 +481,13 @@ ulocimp_toBcpType(const char* key, const char* type, bool* isKnownKey, bool* isS
U_EXPORT const char*
ulocimp_toLegacyType(const char* key, const char* type, bool* isKnownKey, bool* isSpecialType) {
if (isKnownKey != nullptr) {
*isKnownKey = false;
}
if (isSpecialType != nullptr) {
*isSpecialType = false;
}
ulocimp_toLegacyType(const char* key, const char* type) {
if (!init()) {
return nullptr;
}
LocExtKeyData* keyData = static_cast<LocExtKeyData*>(uhash_get(gLocExtKeyMap, key));
if (keyData != nullptr) {
if (isKnownKey != nullptr) {
*isKnownKey = true;
}
LocExtType* t = static_cast<LocExtType*>(uhash_get(keyData->typeMap.getAlias(), type));
if (t != nullptr) {
return t->legacyId;
@ -527,9 +504,6 @@ ulocimp_toLegacyType(const char* key, const char* type, bool* isKnownKey, bool*
matched = isSpecialTypeRgKeyValue(type);
}
if (matched) {
if (isSpecialType != nullptr) {
*isSpecialType = true;
}
return type;
}
}

View file

@ -398,10 +398,10 @@ U_EXPORT const char*
ulocimp_toLegacyKey(const char* key);
U_EXPORT const char*
ulocimp_toBcpType(const char* key, const char* type, bool* isKnownKey, bool* isSpecialType);
ulocimp_toBcpType(const char* key, const char* type);
U_EXPORT const char*
ulocimp_toLegacyType(const char* key, const char* type, bool* isKnownKey, bool* isSpecialType);
ulocimp_toLegacyType(const char* key, const char* type);
/* Function for testing purpose */
U_EXPORT const char* const*