struct icu_chain *icu_chain_create(const char *locale, int sort,
UErrorCode *status)
{
- struct icu_chain *chain
- = (struct icu_chain *) xmalloc(sizeof(*chain));
+ struct icu_chain *chain;
+ UCollator *coll = ucol_open(locale, status);
- *status = U_ZERO_ERROR;
+ if (U_FAILURE(*status))
+ return 0;
+ chain = (struct icu_chain *) xmalloc(sizeof(*chain));
chain->iter = 0;
chain->locale = xstrdup(locale);
-
chain->sort = sort;
-
- chain->coll = ucol_open(chain->locale, status);
-
- if (U_FAILURE(*status))
- return 0;
-
+ chain->coll = coll;
chain->csteps = 0;
return chain;