From: Michael Welsh Duggan Date: Mon, 14 Feb 2011 22:25:29 +0000 (-0500) Subject: Fix use of dtoastr from gnulib. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~875 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=75b43359dd68edd356d9f611ebc3dd5b477fa637;p=emacs.git Fix use of dtoastr from gnulib. * src/print.c (float_to_string): Ensure that a decimal point is printed if using dtoastr (Bug#8033). --- diff --git a/src/ChangeLog b/src/ChangeLog index 2f5749238ff..e3a3137e482 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-02-14 Michael Welsh Duggan + + * print.c (float_to_string): Ensure that a decimal point is + printed if using dtoastr (Bug#8033). + 2011-02-14 Eli Zaretskii * msdos.c (IT_frame_up_to_date): diff --git a/src/print.c b/src/print.c index b5b278bf17f..beb14a8b679 100644 --- a/src/print.c +++ b/src/print.c @@ -1062,7 +1062,10 @@ float_to_string (char *buf, double data) { /* Generate the fewest number of digits that represent the floating point value without losing information. */ - dtoastr (buf, FLOAT_TO_STRING_BUFSIZE, 0, 0, data); + dtoastr (buf, FLOAT_TO_STRING_BUFSIZE - 2, 0, 0, data); + /* The decimal point must be printed, or the byte compiler can + get confused (Bug#8033). */ + width = 1; } else /* oink oink */ { @@ -1117,8 +1120,7 @@ float_to_string (char *buf, double data) cp[1] = '0'; cp[2] = 0; } - - if (*cp == 0) + else if (*cp == 0) { *cp++ = '.'; *cp++ = '0';