X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ficu_chain.c;h=bf614d07633a205399a76766f4e7bffb19cc5567;hb=a3e65bcd3250b107397675bc65b35b5939355025;hp=7bf81095bd92de9d5fe682d7005d1ef4bcc1909a;hpb=689388c889a644a40ca1f447cc862da009049836;p=yaz-moved-to-github.git diff --git a/src/icu_chain.c b/src/icu_chain.c index 7bf8109..bf614d0 100644 --- a/src/icu_chain.c +++ b/src/icu_chain.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2011 Index Data + * Copyright (C) 1995-2012 Index Data * See the file LICENSE for details. */ @@ -192,21 +192,17 @@ struct icu_chain_step *icu_chain_step_clone(struct icu_chain_step *old) 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;