This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: patch: Correct formatting of internatinal currency
- From: Ulrich Drepper <drepper at redhat dot com>
- To: Petter Reinholdtsen <pere at hungry dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Sun, 14 Sep 2003 13:36:16 -0700
- Subject: Re: patch: Correct formatting of internatinal currency
- Organization: Red Hat, Inc.
- References: <E19ybB3-0000xj-00@minerva.hungry.com>
Petter Reinholdtsen wrote:
> +#define GET_VALUE(value, category, int_format, item, int_item) \
> +do { \
> + value = CHAR_MAX; \
> + if (int_format) \
> + { \
> + value = *_NL_CURRENT (category, int_item); \
> + } \
> + if (value == CHAR_MAX) \
> + { \
> + value = *_NL_CURRENT (category, item); \
I don't see a reason for this complicated macro. The international
value for most fields is always defined. The only exception is
int_frac_digits. And here the value -1 is used (not CHAR_MAX) and it
has a legitimate meaning.
So the whole macro expansion should be
*_NL_CURRENT (category, int_format ? int_item : item)
Drop the 'value' parameter in the macro, and make the assignment
explicit in the code.
And drop the extra { } around single statements, they just make the code
less readable.
--
--------------. ,-. 444 Castro Street
Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA
Red Hat `--' drepper at redhat.com `---------------------------