# HG changeset patch # User Paul Eggert # Date 1294561281 28800 # Node ID deae5bb3f0f6561b91f3eb8786ea6570d5b4464f # Parent 7df2e30d72ec55fe6ba14d056875bb93fc166562 Give a name FLOAT_TO_STRING_BUFSIZE to the constant 350. * lisp.h (FLOAT_TO_STRING_BUFSIZE): New macro. * data.c (Fnumber_to_string): Use it. * print.c (float_to_string, print_object): Likewise. diff -r 7df2e30d72ec -r deae5bb3f0f6 src/ChangeLog --- a/src/ChangeLog Sun Jan 09 00:12:35 2011 -0800 +++ b/src/ChangeLog Sun Jan 09 00:21:21 2011 -0800 @@ -1,5 +1,10 @@ 2011-01-09 Paul Eggert + Give a name FLOAT_TO_STRING_BUFSIZE to the constant 350. + * lisp.h (FLOAT_TO_STRING_BUFSIZE): New macro. + * data.c (Fnumber_to_string): Use it. + * print.c (float_to_string, print_object): Likewise. + Include unilaterally. * alloc.c, atimer.c, buffer.c, callproc.c, dired.c, dispnew.c, doc.c: * doprnt.c, editfns.c, emacs.c, fileio.c, filelock.c, fns.c: diff -r 7df2e30d72ec -r deae5bb3f0f6 src/data.c --- a/src/data.c Sun Jan 09 00:12:35 2011 -0800 +++ b/src/data.c Sun Jan 09 00:21:21 2011 -0800 @@ -2375,7 +2375,7 @@ if (FLOATP (number)) { - char pigbuf[350]; /* see comments in float_to_string */ + char pigbuf[FLOAT_TO_STRING_BUFSIZE]; float_to_string (pigbuf, XFLOAT_DATA (number)); return build_string (pigbuf); diff -r 7df2e30d72ec -r deae5bb3f0f6 src/lisp.h --- a/src/lisp.h Sun Jan 09 00:12:35 2011 -0800 +++ b/src/lisp.h Sun Jan 09 00:21:21 2011 -0800 @@ -2781,6 +2781,7 @@ Lisp_Object); extern Lisp_Object internal_with_output_to_temp_buffer (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object); +#define FLOAT_TO_STRING_BUFSIZE 350 extern void float_to_string (unsigned char *, double); extern void syms_of_print (void); diff -r 7df2e30d72ec -r deae5bb3f0f6 src/print.c --- a/src/print.c Sun Jan 09 00:12:35 2011 -0800 +++ b/src/print.c Sun Jan 09 00:21:21 2011 -0800 @@ -1054,6 +1054,7 @@ * case of -1e307 in 20d float_output_format. What is one to do (short of * re-writing _doprnt to be more sane)? * -wsr + * Given the above, the buffer must be least FLOAT_TO_STRING_BUFSIZE bytes. */ void @@ -1100,9 +1101,8 @@ lose: { /* Generate the fewest number of digits that represent the - floating point value without losing information. - The 350 is by convention, e.g., this file's pigbuf. */ - dtoastr (buf, 350, 0, 0, data); + floating point value without losing information. */ + dtoastr (buf, FLOAT_TO_STRING_BUFSIZE, 0, 0, data); } else /* oink oink */ { @@ -1493,7 +1493,7 @@ case Lisp_Float: { - char pigbuf[350]; /* see comments in float_to_string */ + char pigbuf[FLOAT_TO_STRING_BUFSIZE]; float_to_string (pigbuf, XFLOAT_DATA (obj)); strout (pigbuf, -1, -1, printcharfun, 0);