aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-01-09 00:21:21 -0800
committerPaul Eggert2011-01-09 00:21:21 -0800
commit6e8e6bf2535c24b8e8127cc3768d07b528db6d87 (patch)
tree1465940e2ce2bb189d76b63541f5e30168c0a3d9 /src
parent4004364e6777a1ed2c3e2c0fdf9fed871b186ac3 (diff)
downloademacs-6e8e6bf2535c24b8e8127cc3768d07b528db6d87.tar.gz
emacs-6e8e6bf2535c24b8e8127cc3768d07b528db6d87.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/data.c2
-rw-r--r--src/lisp.h1
-rw-r--r--src/print.c8
4 files changed, 11 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7374c4d878d..353f9c2d64a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
12011-01-09 Paul Eggert <eggert@cs.ucla.edu> 12011-01-09 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Give a name FLOAT_TO_STRING_BUFSIZE to the constant 350.
4 * lisp.h (FLOAT_TO_STRING_BUFSIZE): New macro.
5 * data.c (Fnumber_to_string): Use it.
6 * print.c (float_to_string, print_object): Likewise.
7
3 Include <unistd.h> unilaterally. 8 Include <unistd.h> unilaterally.
4 * alloc.c, atimer.c, buffer.c, callproc.c, dired.c, dispnew.c, doc.c: 9 * alloc.c, atimer.c, buffer.c, callproc.c, dired.c, dispnew.c, doc.c:
5 * doprnt.c, editfns.c, emacs.c, fileio.c, filelock.c, fns.c: 10 * doprnt.c, editfns.c, emacs.c, fileio.c, filelock.c, fns.c:
diff --git a/src/data.c b/src/data.c
index 8816d7201f3..31cf0fcde51 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2375,7 +2375,7 @@ NUMBER may be an integer or a floating point number. */)
2375 2375
2376 if (FLOATP (number)) 2376 if (FLOATP (number))
2377 { 2377 {
2378 char pigbuf[350]; /* see comments in float_to_string */ 2378 char pigbuf[FLOAT_TO_STRING_BUFSIZE];
2379 2379
2380 float_to_string (pigbuf, XFLOAT_DATA (number)); 2380 float_to_string (pigbuf, XFLOAT_DATA (number));
2381 return build_string (pigbuf); 2381 return build_string (pigbuf);
diff --git a/src/lisp.h b/src/lisp.h
index eadbbacbff4..1f507123d83 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2781,6 +2781,7 @@ extern void print_error_message (Lisp_Object, Lisp_Object, const char *,
2781 Lisp_Object); 2781 Lisp_Object);
2782extern Lisp_Object internal_with_output_to_temp_buffer 2782extern Lisp_Object internal_with_output_to_temp_buffer
2783 (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object); 2783 (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object);
2784#define FLOAT_TO_STRING_BUFSIZE 350
2784extern void float_to_string (unsigned char *, double); 2785extern void float_to_string (unsigned char *, double);
2785extern void syms_of_print (void); 2786extern void syms_of_print (void);
2786 2787
diff --git a/src/print.c b/src/print.c
index 993b17b668d..961400f4726 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1054,6 +1054,7 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context,
1054 * case of -1e307 in 20d float_output_format. What is one to do (short of 1054 * case of -1e307 in 20d float_output_format. What is one to do (short of
1055 * re-writing _doprnt to be more sane)? 1055 * re-writing _doprnt to be more sane)?
1056 * -wsr 1056 * -wsr
1057 * Given the above, the buffer must be least FLOAT_TO_STRING_BUFSIZE bytes.
1057 */ 1058 */
1058 1059
1059void 1060void
@@ -1100,9 +1101,8 @@ float_to_string (unsigned char *buf, double data)
1100 lose: 1101 lose:
1101 { 1102 {
1102 /* Generate the fewest number of digits that represent the 1103 /* Generate the fewest number of digits that represent the
1103 floating point value without losing information. 1104 floating point value without losing information. */
1104 The 350 is by convention, e.g., this file's pigbuf. */ 1105 dtoastr (buf, FLOAT_TO_STRING_BUFSIZE, 0, 0, data);
1105 dtoastr (buf, 350, 0, 0, data);
1106 } 1106 }
1107 else /* oink oink */ 1107 else /* oink oink */
1108 { 1108 {
@@ -1493,7 +1493,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1493 1493
1494 case Lisp_Float: 1494 case Lisp_Float:
1495 { 1495 {
1496 char pigbuf[350]; /* see comments in float_to_string */ 1496 char pigbuf[FLOAT_TO_STRING_BUFSIZE];
1497 1497
1498 float_to_string (pigbuf, XFLOAT_DATA (obj)); 1498 float_to_string (pigbuf, XFLOAT_DATA (obj));
1499 strout (pigbuf, -1, -1, printcharfun, 0); 1499 strout (pigbuf, -1, -1, printcharfun, 0);