X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Funinorm%2Fu-normxfrm.h;h=bd33be3fd32c5854bb8ccb3b1ea69134910a132b;hb=0f5a4162a9a8361be7e1c63b8e438002bfdee945;hp=60036b10580c5c8a238afc8b7b9d00423fb6f2ab;hpb=401aeb2d65f0dc85ddf318bec7454dc403c0bf8e;p=gnulib.git diff --git a/lib/uninorm/u-normxfrm.h b/lib/uninorm/u-normxfrm.h index 60036b105..bd33be3fd 100644 --- a/lib/uninorm/u-normxfrm.h +++ b/lib/uninorm/u-normxfrm.h @@ -1,5 +1,5 @@ /* Locale dependent transformation for comparison of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2012 Free Software Foundation, Inc. Written by Bruno Haible , 2009. This program is free software: you can redistribute it and/or modify it @@ -25,7 +25,6 @@ FUNC (const UNIT *s, size_t n, uninorm_t nf, char convsbuf[2048]; char *convs; size_t convs_length; - int ret; char *result; /* Normalize the Unicode string. */ @@ -36,21 +35,20 @@ FUNC (const UNIT *s, size_t n, uninorm_t nf, return NULL; /* Convert it to locale encoding. */ - convs = convsbuf; convs_length = sizeof (convsbuf) - 1; - ret = U_CONV_TO_ENCODING (locale_charset (), - iconveh_error, - norms, norms_length, - NULL, - &convs, &convs_length); - if (ret < 0) + convs = U_CONV_TO_ENCODING (locale_charset (), + iconveh_error, + norms, norms_length, + NULL, + convsbuf, &convs_length); + if (convs == NULL) { if (norms != normsbuf) - { - int saved_errno = errno; - free (norms); - errno = saved_errno; - } + { + int saved_errno = errno; + free (norms); + errno = saved_errno; + } return NULL; } @@ -62,24 +60,24 @@ FUNC (const UNIT *s, size_t n, uninorm_t nf, { char *memory = (char *) realloc (convs, convs_length + 1); if (memory == NULL) - { - free (convs); - errno = ENOMEM; - return NULL; - } + { + free (convs); + errno = ENOMEM; + return NULL; + } convs = memory; } /* Apply locale dependent transformations for comparison. */ - result = memxfrm (convs, convs_length, resultbuf, lengthp); + result = amemxfrm (convs, convs_length, resultbuf, lengthp); if (result == NULL) { if (convs != convsbuf) - { - int saved_errno = errno; - free (convs); - errno = saved_errno; - } + { + int saved_errno = errno; + free (convs); + errno = saved_errno; + } return NULL; }