From: Erwin Janssen Date: Sun, 8 Jan 2017 23:45:02 +0000 (+0100) Subject: Remove usage of _ast_int and _ast_flt defines X-Git-Tag: 2.42.0~213^2~2^2~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ed579294b882600fd6c883ef456c5c4a0ae8158;p=graphviz Remove usage of _ast_int and _ast_flt defines The definition of these defines was removed in a previous commit (2ee0993a22db6faa8506ac1c69164a5120dbd76c) but the usage was still present. This is corrected by removing the usage as well. --- diff --git a/lib/sfio/sfcvt.c b/lib/sfio/sfcvt.c index b9020ee4d..a446171a7 100644 --- a/lib/sfio/sfcvt.c +++ b/lib/sfio/sfcvt.c @@ -42,82 +42,6 @@ char *_sfcvt(void * dv, int n_digit, int *decpt, int *sign, int format) return SF_INFINITE; *sign = *decpt = 0; - -#if !defined(_ast_fltmax_double) - if (format & SFFMT_LDOUBLE) { - Sfdouble_t dval = *((Sfdouble_t *) dv); - - if (dval == 0.) - return SF_ZERO; - else if ((*sign = (dval < 0.))) /* assignment = */ - dval = -dval; - - n = 0; - if (dval >= (Sfdouble_t) SF_MAXLONG) { /* scale to a small enough number to fit an int */ - v = SF_MAXEXP10 - 1; - do { - if (dval < _Sfpos10[v]) - v -= 1; - else { - dval *= _Sfneg10[v]; - if ((n += (1 << v)) >= SF_IDIGITS) - return SF_INFINITE; - } - } while (dval >= (Sfdouble_t) SF_MAXLONG); - } - *decpt = (int) n; - - buf = sp = Buf + SF_INTPART; - if ((v = (int) dval) != 0) { /* translate the integer part */ - dval -= (Sfdouble_t) v; - - sfucvt(v, sp, n, ep, long, ulong); - - n = buf - sp; - if ((*decpt += (int) n) >= SF_IDIGITS) - return SF_INFINITE; - buf = sp; - sp = Buf + SF_INTPART; - } else - n = 0; - - /* remaining number of digits to compute; add 1 for later rounding */ - n = (((format & SFFMT_EFORMAT) - || *decpt <= 0) ? 1 : *decpt + 1) - n; - if (n_digit > 0) - n += n_digit; - - if ((ep = (sp + n)) > (endsp = Buf + (SF_MAXDIGITS - 2))) - ep = endsp; - if (sp > ep) - sp = ep; - else { - if ((format & SFFMT_EFORMAT) && *decpt == 0 && dval > 0.) { - Sfdouble_t d; - while ((int) (d = dval * 10.) == 0) { - dval = d; - *decpt -= 1; - } - } - - while (sp < ep) { /* generate fractional digits */ - if (dval <= 0.) { /* fill with 0's */ - do { - *sp++ = '0'; - } while (sp < ep); - goto done; - } else if ((n = (long) (dval *= 10.)) < 10) { - *sp++ = '0' + n; - dval -= n; - } else { /* n == 10 */ - do { - *sp++ = '9'; - } while (sp < ep); - } - } - } - } else -#endif { double dval = *((double *) dv); diff --git a/lib/sfio/sfhdr.h b/lib/sfio/sfhdr.h index 6e17975c6..eef417915 100644 --- a/lib/sfio/sfhdr.h +++ b/lib/sfio/sfhdr.h @@ -175,18 +175,6 @@ extern "C" { #define remove unlink #endif -#if !defined(_ast_fltmax_double) - -#if defined(_lib_qfrexp) && _lib_qldexp -#define _has_expfuncs 1 -#define frexp qfrexp -#define ldexp qldexp -#else -#define _has_expfuncs 0 -#endif - -#endif/*_ast_fltmax_double*/ - /* 64-bit vs 32-bit file stuff */ #if _sys_stat #ifdef _LARGEFILE64_SOURCE @@ -706,13 +694,8 @@ extern "C" { /* floating point to ascii conversion */ #define SF_MAXEXP10 6 #define SF_MAXPOW10 (1 << SF_MAXEXP10) -#if !defined(_ast_fltmax_double) -#define SF_FDIGITS 1024 /* max allowed fractional digits */ -#define SF_IDIGITS (8*1024) /* max number of digits in int part */ -#else #define SF_FDIGITS 256 /* max allowed fractional digits */ #define SF_IDIGITS 1024 /* max number of digits in int part */ -#endif #define SF_MAXDIGITS (((SF_FDIGITS+SF_IDIGITS)/sizeof(int) + 1)*sizeof(int)) /* tables for numerical translation */ diff --git a/lib/sfio/sfputd.c b/lib/sfio/sfputd.c index e5459eeb6..64ab9eaf3 100644 --- a/lib/sfio/sfputd.c +++ b/lib/sfio/sfputd.c @@ -42,13 +42,6 @@ int _sfputd(Sfio_t * f, Sfdouble_t v) } else n = 0; -#if !defined(_ast_fltmax_double) /* don't know how to do these yet */ - if (v > DBL_MAX && !_has_expfuncs) { - SFOPEN(f, 0); - SFMTXRETURN(f, -1); - } -#endif - /* make the magnitude of v < 1 */ if (v != 0.) v = frexp(v, &exp); diff --git a/lib/sfio/sftable.c b/lib/sfio/sftable.c index 79a8ddb91..ab88ac352 100644 --- a/lib/sfio/sftable.c +++ b/lib/sfio/sftable.c @@ -353,22 +353,12 @@ static Fmtpos_t *sffmtpos(Sfio_t * f, const char *form, va_list args, switch (_Sftype[fp[n].ft.fmt]) { case SFFMT_INT: case SFFMT_UINT: -#if !_ast_intmax_long - if (FMTCMP(size, Sflong_t, Sflong_t)) - fp[n].argv.ll = va_arg(args, Sflong_t); - else -#endif if (FMTCMP(size, long, Sflong_t)) fp[n].argv.l = va_arg(args, long); else fp[n].argv.i = va_arg(args, int); break; case SFFMT_FLOAT: -#if !defined(_ast_fltmax_double) - if (FMTCMP(size, Sfdouble_t, Sfdouble_t)) - fp[n].argv.ld = va_arg(args, Sfdouble_t); - else -#endif fp[n].argv.d = va_arg(args, double); break; case SFFMT_POINTER: diff --git a/lib/sfio/sfvprintf.c b/lib/sfio/sfvprintf.c index 7d80a38e5..460d7fea2 100644 --- a/lib/sfio/sfvprintf.c +++ b/lib/sfio/sfvprintf.c @@ -40,9 +40,6 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args) int sign, decpt; ssize_t size; double dval; -#if !defined(_ast_fltmax_double) - Sfdouble_t ldval; -#endif char *tls[2], **ls; /* for %..[separ]s */ char *t_str; /* stuff between () */ ssize_t n_str; /* its length */ @@ -421,22 +418,12 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args) switch (_Sftype[fmt]) { case SFFMT_INT: case SFFMT_UINT: -#if !_ast_intmax_long - if (FMTCMP(size, Sflong_t, Sflong_t)) - argv.ll = va_arg(args, Sflong_t); - else -#endif if (FMTCMP(size, long, Sflong_t)) argv.l = va_arg(args, long); else argv.i = va_arg(args, int); break; case SFFMT_FLOAT: -#if !defined(_ast_fltmax_double) - if (FMTCMP(size, Sfdouble_t, Sfdouble_t)) - argv.ld = va_arg(args, Sfdouble_t); - else -#endif argv.d = va_arg(args, double); break; case SFFMT_POINTER: @@ -569,11 +556,6 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args) case 'n': /* return current output length */ SFEND(f); -#if !_ast_intmax_long - if (FMTCMP(size, Sflong_t, Sflong_t)) - *((Sflong_t *) argv.vp) = (Sflong_t) n_output; - else -#endif if (FMTCMP(size, long, Sflong_t)) *((long *) argv.vp) = (long) n_output; else if (sizeof(short) < sizeof(int) && @@ -635,7 +617,7 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args) n_s = base == 10 ? -1 : 0; int_arg: -#if !_ast_intmax_long || _more_long_int || _more_void_int +#if _more_long_int || _more_void_int if (FMTCMP(size, Sflong_t, Sflong_t)) { lv = argv.ll; goto long_cvt; @@ -784,11 +766,6 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args) case 'e': case 'E': case 'f': -#if !defined(_ast_fltmax_double) - if (FMTCMP(size, Sfdouble_t, Sfdouble_t)) - ldval = argv.ld; - else -#endif if (!(ft && ft->extf && (ft->flags & SFFMT_VALUE)) || FMTCMP(size, double, Sfdouble_t)) dval = argv.d; @@ -797,13 +774,6 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args) if (fmt == 'e' || fmt == 'E') { n = (precis = precis < 0 ? FPRECIS : precis) + 1; -#if !defined(_ast_fltmax_double) - if (FMTCMP(size, Sfdouble_t, Sfdouble_t)) { - ep = _sfcvt(&ldval, min(n, SF_FDIGITS), - &decpt, &sign, - SFFMT_EFORMAT | SFFMT_LDOUBLE); - } else -#endif { ep = _sfcvt(&dval, min(n, SF_FDIGITS), &decpt, &sign, SFFMT_EFORMAT); @@ -811,12 +781,6 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args) goto e_format; } else if (fmt == 'f' || fmt == 'F') { precis = precis < 0 ? FPRECIS : precis; -#if !defined(_ast_fltmax_double) - if (FMTCMP(size, Sfdouble_t, Sfdouble_t)) { - ep = _sfcvt(&ldval, min(precis, SF_FDIGITS), - &decpt, &sign, SFFMT_LDOUBLE); - } else -#endif { ep = _sfcvt(&dval, min(precis, SF_FDIGITS), &decpt, &sign, 0); @@ -826,16 +790,6 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args) /* 'g' or 'G' format */ precis = precis < 0 ? FPRECIS : precis == 0 ? 1 : precis; -#if !defined(_ast_fltmax_double) - if (FMTCMP(size, Sfdouble_t, Sfdouble_t)) { - ep = _sfcvt(&ldval, min(precis, SF_FDIGITS), - &decpt, &sign, SFFMT_EFORMAT | SFFMT_LDOUBLE); - if (ldval == 0.) - decpt = 1; - else if (*ep == 'I') - goto infinite; - } else -#endif { ep = _sfcvt(&dval, min(precis, SF_FDIGITS), &decpt, &sign, SFFMT_EFORMAT); @@ -877,10 +831,6 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args) /* build the exponent */ ep = endep = buf + (sizeof(buf) - 1); -#if !defined(_ast_fltmax_double) - if (FMTCMP(size, Sfdouble_t, Sfdouble_t)) - dval = ldval ? 1. : 0.; /* so the below test works */ -#endif if (dval != 0.) { if ((n = decpt - 1) < 0) n = -n; diff --git a/lib/sfio/sfvscanf.c b/lib/sfio/sfvscanf.c index c36e74b31..b4a59c44f 100644 --- a/lib/sfio/sfvscanf.c +++ b/lib/sfio/sfvscanf.c @@ -471,11 +471,6 @@ int sfvscanf(Sfio_t * f, reg const char *form, va_list args) value = va_arg(args, void *); if (fmt == 'n') { /* return length of consumed input */ -#if !_ast_intmax_long - if (FMTCMP(size, Sflong_t, Sflong_t)) - *((Sflong_t *) value) = (Sflong_t) (n_input + SFLEN(f)); - else -#endif if (sizeof(long) > sizeof(int) && FMTCMP(size, long, Sflong_t)) *((long *) value) = (long) (n_input + SFLEN(f)); else if (sizeof(short) < sizeof(int) && @@ -539,21 +534,11 @@ int sfvscanf(Sfio_t * f, reg const char *form, va_list args) if (value) { *val = '\0'; -#if !defined(_ast_fltmax_double) - if (FMTCMP(size, Sfdouble_t, Sfdouble_t)) - argv.ld = _sfstrtod(accept, NIL(char **)); - else -#endif argv.d = (double) strtod(accept, NIL(char **)); } if (value) { n_assign += 1; -#if !defined(_ast_fltmax_double) - if (FMTCMP(size, Sfdouble_t, Sfdouble_t)) - *((Sfdouble_t *) value) = argv.ld; - else -#endif if (FMTCMP(size, double, Sfdouble_t)) *((double *) value) = argv.d; else @@ -670,10 +655,6 @@ int sfvscanf(Sfio_t * f, reg const char *form, va_list args) *((void **) value) = (void *) ((ulong) argv.lu); #else *((void **) value) = (void *) ((uint) argv.lu); -#endif -#if !_ast_intmax_long - else if (FMTCMP(size, Sflong_t, Sflong_t)) - *((Sflong_t *) value) = argv.ll; #endif else if (sizeof(long) > sizeof(int) && FMTCMP(size, long, Sflong_t)) {