Re: [evolution-patches] Patch to e-util.c



On Wed, 2005-07-06 at 14:35 +0100, Ross Burton wrote:
> +#define MAX_DECOMP 8
>  static gunichar
>  stripped_char (gunichar ch)
>  {
>          gunichar decomp[MAX_DECOMP];
> +        gunichar *temp;
>          GUnicodeType utype;
>          gint dlen;
>                                                                                  
> @@ -1529,8 +212,12 @@
>                  /* Convert to lowercase, fall through */
>                  ch = g_unichar_tolower (ch);
>          case G_UNICODE_LOWERCASE_LETTER:
> -                dlen = canonical_decomposition (ch, decomp);
> -                if (dlen > 0) return *decomp;
> +                temp = g_unicode_canonical_decomposition (ch, &dlen);
> +                if (temp) {
> +                        memcpy (decomp, temp, dlen*4);
> +                        g_free (temp);
> +                        return decomp[0];
> +                }
>                  break;
>          }

wouldn't it be simpler to just do the following?

gunichar *decomp, retval;

...

if ((decomp = g_unicode_canonical_decomposition (ch, &dlen))) {
   retval = decomp[0];
   g_free (decomp);
   return retval;
}

Jeff




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]