bug-gnulib
[Top][All Lists]
Advanced

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

iconv modules


From: Bruno Haible
Subject: iconv modules
Date: Mon, 4 Sep 2006 14:22:53 +0200
User-agent: KMail/1.9.1

Hi Simon,

I'm trying to unify your 'iconvme' module and my 'iconvstring' module (from
GNU gettext).

  extern char *iconv_string (const char *string, const char *from_code,
                             const char *to_code);
  extern char *iconv_alloc (iconv_t cd, const char *string);

vs.

  extern int iconv_string (iconv_t cd, const char *start, const char *end,
                           char **resultp, size_t *lengthp);

The differences between the functions are
  - working on NUL terminated strings, assuming encodings other than
    UTF-16 or UTF32 - vs. working on arbitrary memory regions.
  - taking a conversion descriptor - vs. taking from_code and to_code
    arguments,
  - use of malloc vs. xalloc (implies LGPL vs. GPL).

All of these options are useful in some way or the other. Therefore I'd like
to keep all the options, and distinguish them through a consistent
nomenclature.
  - "str" vs. "mem",
  - infix "cd" vs. none (similar to 'stat' and 'fstat' - the most natural among
    the two has no prefix, the one taking a descriptor has a prefix),
  - "x" for checked memory allocation.

So the proposal is:

  - Module 'striconv' (LGPL):

    exzern char *str_iconv (const char *string,
                            const char *from_code, const char *to_code);
    extern char *str_cd_iconv (const char *string, iconv_t cd);
    extern int mem_cd_iconv (const char *start, size_t length, iconv_t cd,
                             char **resultp, size_t *lengthp);

  - Module 'xstriconv' (GPL):

    exzern char *xstr_iconv (const char *string,
                             const char *from_code, const char *to_code);
    extern char *xstr_cd_iconv (const char *string, iconv_t cd);
    extern int xmem_cd_iconv (const char *start, size_t length, iconv_t cd,
                              char **resultp, size_t *lengthp);

Migration for existing code:
iconvme::iconv_string -> str_iconv
iconvme::iconv_alloc -> str_cd_iconv (with reversed arguments)
iconvstring::iconv_string -> xmem_cd_iconv (with modified arguments)

How does that sound? Is it acceptable?

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]