patch: Correct formatting of internatinal currency

Ulrich Drepper drepper@redhat.com
Sun Sep 14 20:37:00 GMT 2003


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 `---------------------------



More information about the Libc-alpha mailing list