[Top][All Lists]

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

Re: [PATCH] Add !HAVE_MBRTOWC fallbacks for mbchar, mbiter and mbuiter

From: Bruno Haible
Subject: Re: [PATCH] Add !HAVE_MBRTOWC fallbacks for mbchar, mbiter and mbuiter
Date: Fri, 16 Feb 2007 04:57:12 +0100
User-agent: KMail/1.5.4

[This is a reply to 
= <http://article.gmane.org/gmane.comp.lib.gnulib.bugs/9149>.
I don't know why this did not appear in the bug-gnulib archives and was not
sent to all bug-gnulib subscribers.]

Hi Miloslav,

Thanks for the suggested change.

There are probably two uses of the mbchar, mbfile, mbiter, mbuiter modules:
  (a) Use them only for MB_CUR_MAX > 1, and use simpler datatypes (just
      'char' and pointers) for MB_CUR_MAX = 1.
  (b) Use them always.

Since the speed difference between both approaches can be considerable,
(a factor of 5 is not unusual), in gnulib we're most often using approach (a).
Whereas your macros appear to be made for case (b) and not well usable for
case (a).

Find attached some macros that work for both cases. They require that you
use uppercase macros instead of lowercase function names. The advantage is
that with the proper (conditional) #includes, you have a version of the
same code that, for MB_CUR_MAX = 1, is much faster. (I don't know if that
matters for the 'info' reader, though.)

Also, when MB_CUR_MAX = 1, the 'struct mbchar' can be replaced by a single
'char' - there is no need for a 'valid' boolean.

What do you think? Can this code be useful for you?


Attachment: mb_switched.zip
Description: Zip archive

reply via email to

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