Skip to content

Commit

Permalink
ICU-22954 re-qualify local pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
markusicu committed Dec 13, 2024
1 parent edba727 commit e7dd6fc
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
3 changes: 2 additions & 1 deletion icu4c/source/common/characterproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "umutex.h"
#include "uprops.h"

using U_ICU_NAMESPACE_OR_INTERNAL::LocalPointer;
#if !UCONFIG_NO_NORMALIZATION
using icu::Normalizer2Factory;
using icu::Normalizer2Impl;
Expand Down Expand Up @@ -339,7 +340,7 @@ UnicodeSet *makeSet(UProperty property, UErrorCode &errorCode) {
UCPMap *makeMap(UProperty property, UErrorCode &errorCode) {
if (U_FAILURE(errorCode)) { return nullptr; }
uint32_t nullValue = property == UCHAR_SCRIPT ? USCRIPT_UNKNOWN : 0;
LocalUMutableCPTriePointer mutableTrie(
U_ICU_NAMESPACE_OR_INTERNAL::LocalUMutableCPTriePointer mutableTrie(
umutablecptrie_open(nullValue, nullValue, &errorCode));
const UnicodeSet *inclusions =
icu::CharacterProperties::getInclusionsForProperty(property, errorCode);
Expand Down
2 changes: 1 addition & 1 deletion icu4c/source/common/locavailable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ UBool U_CALLCONV uloc_cleanup() {
void U_CALLCONV loadInstalledLocales(UErrorCode& status) {
ucln_common_registerCleanup(UCLN_COMMON_ULOC, uloc_cleanup);

LocalUResourceBundlePointer rb(
U_ICU_NAMESPACE_OR_INTERNAL::LocalUResourceBundlePointer rb(
ures_openDirect(nullptr, "res_index", &status));
AvailableLocalesSink sink;
ures_getAllItemsWithFallback(rb.getAlias(), "", sink, status);
Expand Down
3 changes: 3 additions & 0 deletions icu4c/source/common/locdispnames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
#include "ureslocs.h"
#include "ustr_imp.h"

using U_ICU_NAMESPACE_OR_INTERNAL::LocalUEnumerationPointer;
using U_ICU_NAMESPACE_OR_INTERNAL::LocalUResourceBundlePointer;

// C++ API ----------------------------------------------------------------- ***

U_NAMESPACE_BEGIN
Expand Down
2 changes: 1 addition & 1 deletion icu4c/source/common/locresdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
* this falls back through the locale's chain to root
*/
errorCode=U_ZERO_ERROR;
LocalUResourceBundlePointer rb(
U_ICU_NAMESPACE_OR_INTERNAL::LocalUResourceBundlePointer rb(
ures_open(path, locale, &errorCode));

if(U_FAILURE(errorCode)) {
Expand Down
3 changes: 2 additions & 1 deletion icu4c/source/common/locutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ LocaleUtility::getAvailableLocaleNames(const UnicodeString& bundleID)
CharString cbundleID;
cbundleID.appendInvariantChars(bundleID, status);
const char* path = cbundleID.isEmpty() ? nullptr : cbundleID.data();
LocalUEnumerationPointer uenum(ures_openAvailableLocales(path, &status));
U_ICU_NAMESPACE_OR_INTERNAL::LocalUEnumerationPointer uenum(
ures_openAvailableLocales(path, &status));
for (;;) {
const char16_t* id = uenum_unext(uenum.getAlias(), nullptr, &status);
if (id == nullptr) {
Expand Down
2 changes: 1 addition & 1 deletion icu4c/source/common/uloc_keytype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ typedef enum {
struct LocExtKeyData : public icu::UMemory {
std::string_view legacyId;
std::string_view bcpId;
LocalUHashtablePointer typeMap;
U_ICU_NAMESPACE_OR_INTERNAL::LocalUHashtablePointer typeMap;
uint32_t specialTypes;
};

Expand Down
9 changes: 4 additions & 5 deletions icu4c/source/common/uloc_tag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#include "ulocimp.h"
#include "uassert.h"

using U_ICU_NAMESPACE_OR_INTERNAL::LocalPointer;
using U_ICU_NAMESPACE_OR_INTERNAL::LocalUEnumerationPointer;

namespace {

/* struct holding a single variant */
Expand Down Expand Up @@ -354,10 +357,6 @@ const char*
ultag_getLegacy(const ULanguageTag* langtag);
#endif

} // namespace

namespace U_ICU_NAMESPACE_OR_INTERNAL {

/**
* \class LocalULanguageTagPointer
* "Smart pointer" class, closes a ULanguageTag via ultag_close().
Expand All @@ -369,7 +368,7 @@ namespace U_ICU_NAMESPACE_OR_INTERNAL {
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalULanguageTagPointer, ULanguageTag, ultag_close);

}
} // namespace

/*
* -------------------------------------------------
Expand Down

0 comments on commit e7dd6fc

Please sign in to comment.