This is the mail archive of the cygwin-developers mailing list for the Cygwin 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]

just made a change I didn't like to strfmon.c


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

The above is a kludge but it seems like the lconv structure doesn't use
const char * strings for some reason.

And, what's up with comparing a pointer against '\0'?

cgf


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