This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: patch: Correct formatting of internatinal currency


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]