lib/icu: add IcuInit(), IcuFinish()

This commit is contained in:
Max Kellermann
2014-06-10 22:38:00 +02:00
parent d51265d48f
commit 37b3190752
5 changed files with 86 additions and 11 deletions

View File

@@ -43,10 +43,11 @@
static UCollator *collator;
#endif
#ifdef HAVE_ICU
bool
IcuCollateInit(Error &error)
{
#ifdef HAVE_ICU
assert(collator == nullptr);
assert(!error.IsDefined());
@@ -57,9 +58,6 @@ IcuCollateInit(Error &error)
"ucol_open() failed: %s", u_errorName(code));
return false;
}
#else
(void)error;
#endif
return true;
}
@@ -67,15 +65,11 @@ IcuCollateInit(Error &error)
void
IcuCollateFinish()
{
#ifdef HAVE_ICU
assert(collator != nullptr);
ucol_close(collator);
#endif
}
#ifdef HAVE_ICU
static WritableBuffer<UChar>
UCharFromUTF8(const char *src)
{