From 1d6cd0231d7d52bd618ea33db95d3f83ba9915a5 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 8 Nov 2007 17:22:48 +0000 Subject: [PATCH] Allow any locale for icu_chain_create. --- include/yaz/icu_I18N.h | 2 +- src/icu_I18N.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/yaz/icu_I18N.h b/include/yaz/icu_I18N.h index 9f0c2eb..8bf0de8 100644 --- a/include/yaz/icu_I18N.h +++ b/include/yaz/icu_I18N.h @@ -224,7 +224,7 @@ void icu_chain_step_destroy(struct icu_chain_step * step); struct icu_chain { - char locale[16]; + char *locale; int sort; const char * src8cstr; diff --git a/src/icu_I18N.c b/src/icu_I18N.c index 28055bd..a082b1f 100644 --- a/src/icu_I18N.c +++ b/src/icu_I18N.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: icu_I18N.c,v 1.17 2007-11-08 17:20:32 adam Exp $ + * $Id: icu_I18N.c,v 1.18 2007-11-08 17:22:49 adam Exp $ */ #if HAVE_CONFIG_H @@ -839,8 +839,7 @@ struct icu_chain * icu_chain_create(const char *locale, *status = U_ZERO_ERROR; - strncpy((char *) chain->locale, (const char *) locale, 16); - chain->locale[16 - 1] = '\0'; + chain->locale = xstrdup(locale); chain->sort = sort; @@ -880,6 +879,7 @@ void icu_chain_destroy(struct icu_chain * chain) icu_buf_utf16_destroy(chain->src16); icu_chain_step_destroy(chain->steps); + xfree(chain->locale); xfree(chain); } } -- 1.7.10.4