diff options
Diffstat (limited to 'lib/libc/stdio/vfprintf.c')
-rw-r--r-- | lib/libc/stdio/vfprintf.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c index afb10b0..fff9aa8 100644 --- a/lib/libc/stdio/vfprintf.c +++ b/lib/libc/stdio/vfprintf.c @@ -267,7 +267,7 @@ vfprintf(FILE *fp, const char *fmt0, va_list ap) #define BUF (MAXEXP+MAXFRACT+1) /* + decimal point */ #define DEFPREC 6 -static char *cvt __P((double, int, int, char *, int *, int, int *, char **)); +static char *cvt __P((double, int, int, char *, int *, int, int *)); static int exponent __P((char *, int, int)); #else /* no FLOATING_POINT */ @@ -313,7 +313,6 @@ __vfprintf(FILE *fp, const char *fmt0, va_list ap) int expsize; /* character count for expstr */ int ndig; /* actual number of digits returned by cvt */ char expstr[7]; /* buffer for exponent string */ - char *dtoaresult; /* buffer allocated by dtoa */ #endif u_long ulval; /* integer arguments %[diouxX] */ u_quad_t uqval; /* %q integers */ @@ -422,9 +421,6 @@ __vfprintf(FILE *fp, const char *fmt0, va_list ap) } -#ifdef FLOATING_POINT - dtoaresult = NULL; -#endif /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */ if (cantwrite(fp)) return (EOF); @@ -610,12 +606,8 @@ fp_begin: if (prec == -1) break; } flags |= FPT; - if (dtoaresult != NULL) { - free(dtoaresult); - dtoaresult = NULL; - } cp = cvt(_double, prec, flags, &softsign, - &expt, ch, &ndig, &dtoaresult); + &expt, ch, &ndig); if (ch == 'g' || ch == 'G') { if (expt <= -4 || expt > prec) ch = (ch == 'g') ? 'e' : 'E'; @@ -871,10 +863,6 @@ number: if ((dprec = prec) >= 0) done: FLUSH(); error: -#ifdef FLOATING_POINT - if (dtoaresult != NULL) - free(dtoaresult); -#endif if (__sferror(fp)) ret = EOF; if ((argtable != NULL) && (argtable != statargtable)) @@ -1206,11 +1194,11 @@ __grow_type_table (int nextarg, unsigned char **typetable, int *tablesize) #ifdef FLOATING_POINT -extern char *__dtoa __P((double, int, int, int *, int *, char **, char **)); +extern char *__dtoa __P((double, int, int, int *, int *, char **)); static char * cvt(double value, int ndigits, int flags, char *sign, int *decpt, - int ch, int *length, char **dtoaresultp) + int ch, int *length) { int mode, dsgn; char *digits, *bp, *rve; @@ -1232,8 +1220,7 @@ cvt(double value, int ndigits, int flags, char *sign, int *decpt, *sign = '-'; } else *sign = '\000'; - digits = __dtoa(value, mode, ndigits, decpt, &dsgn, &rve, - dtoaresultp); + digits = __dtoa(value, mode, ndigits, decpt, &dsgn, &rve); if ((ch != 'g' && ch != 'G') || flags & ALT) { /* print trailing zeros */ bp = digits + ndigits; |