From: Daniel Ju Date: Tue, 29 Jan 2019 03:06:14 +0000 (-0800) Subject: ICU-20220 ICU4C: Use anonymous namespace instead of 'static' keyword in uspoof.cpp X-Git-Tag: release-64-rc~143 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ebd15cf8bd6fe666584bb1d515c1635ccfb50076;p=icu ICU-20220 ICU4C: Use anonymous namespace instead of 'static' keyword in uspoof.cpp --- diff --git a/icu4c/source/i18n/uspoof.cpp b/icu4c/source/i18n/uspoof.cpp index 4ca3a9acd03..55b93c2d806 100644 --- a/icu4c/source/i18n/uspoof.cpp +++ b/icu4c/source/i18n/uspoof.cpp @@ -43,7 +43,9 @@ static UnicodeSet *gRecommendedSet = NULL; static const Normalizer2 *gNfdNormalizer = NULL; static UInitOnce gSpoofInitStaticsOnce = U_INITONCE_INITIALIZER; -static UBool U_CALLCONV +namespace { + +UBool U_CALLCONV uspoof_cleanup(void) { delete gInclusionSet; gInclusionSet = NULL; @@ -54,7 +56,7 @@ uspoof_cleanup(void) { return TRUE; } -static void U_CALLCONV initializeStatics(UErrorCode &status) { +void U_CALLCONV initializeStatics(UErrorCode &status) { static const char16_t *inclusionPat = u"['\\-.\\:\\u00B7\\u0375\\u058A\\u05F3\\u05F4\\u06FD\\u06FE\\u0F0B\\u200C" u"\\u200D\\u2010\\u2019\\u2027\\u30A0\\u30FB]"; @@ -149,6 +151,8 @@ static void U_CALLCONV initializeStatics(UErrorCode &status) { ucln_i18n_registerCleanup(UCLN_I18N_SPOOF, uspoof_cleanup); } +} // namespace + U_CFUNC void uspoof_internalInitStatics(UErrorCode *status) { umtx_initOnce(gSpoofInitStaticsOnce, &initializeStatics, *status); } @@ -546,7 +550,9 @@ uspoof_checkUnicodeString(const USpoofChecker *sc, return uspoof_check2UnicodeString(sc, id, NULL, status); } -static int32_t checkImpl(const SpoofImpl* This, const UnicodeString& id, CheckResult* checkResult, UErrorCode* status) { +namespace { + +int32_t checkImpl(const SpoofImpl* This, const UnicodeString& id, CheckResult* checkResult, UErrorCode* status) { U_ASSERT(This != NULL); U_ASSERT(checkResult != NULL); checkResult->clear(); @@ -638,6 +644,8 @@ static int32_t checkImpl(const SpoofImpl* This, const UnicodeString& id, CheckRe return checkResult->toCombinedBitmask(This->fChecks); } +} // namespace + U_CAPI int32_t U_EXPORT2 uspoof_check2UnicodeString(const USpoofChecker *sc, const icu::UnicodeString &id,