just made a change I didn't like to strfmon.c
Corinna Vinschen
corinna-cygwin@cygwin.com
Fri Jan 29 18:03:00 GMT 2010
On Jan 29 12:40, Christopher Faylor wrote:
> --- libc/strfmon.c 22 Jan 2010 22:31:31 -0000 1.1
> +++ libc/strfmon.c 29 Jan 2010 17:37:08 -0000
> @@ -413,12 +413,13 @@ __setup_vars(int flags, char *cs_precede
> char *sign_posn, char **signstr) {
>
> struct lconv *lc = localeconv();
> + static char negative[] = "-";
>
> if ((flags & IS_NEGATIVE) && (flags & USE_INTL_CURRENCY)) {
> *cs_precedes = lc->int_n_cs_precedes;
> *sep_by_space = lc->int_n_sep_by_space;
> *sign_posn = (flags & PARENTH_POSN) ? 0 : lc->int_n_sign_posn;
> - *signstr = (lc->negative_sign == '\0') ? "-"
> + *signstr = (lc->negative_sign == NULL) ? negative
> : lc->negative_sign;
> } else if (flags & USE_INTL_CURRENCY) {
> *cs_precedes = lc->int_p_cs_precedes;
> @@ -429,7 +430,7 @@ __setup_vars(int flags, char *cs_precede
> *cs_precedes = lc->n_cs_precedes;
> *sep_by_space = lc->n_sep_by_space;
> *sign_posn = (flags & PARENTH_POSN) ? 0 : lc->n_sign_posn;
> - *signstr = (lc->negative_sign == '\0') ? "-"
> + *signstr = (lc->negative_sign == NULL) ? negative
> : lc->negative_sign;
> } else {
> *cs_precedes = lc->p_cs_precedes;
>
> It's 2010. Do we really have to still worry about const char * crap?
> I would have expected this to be all flushed out by now.
This is the original FreeBSD code with only a tiny change concerning
headers. I don't get any compiler warning with gcc 4.3.4, even with '-g
-O2 -Wall -Werror'. What gcc version are you using?
> The above is a kludge but it seems like the lconv structure doesn't use
> const char * strings for some reason.
That's correct. The lconv struct is defined to use char *, not const
char *, in POSIX as well as in Linux.
> And, what's up with comparing a pointer against '\0'?
That's a question for the FreeBSD guys, I guess. After all their
lconv struct is defined exactly the same.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
More information about the Cygwin-developers
mailing list