summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authoremboss <[email protected]>2012-09-11 03:02:28 +0200
committeremboss <[email protected]>2012-09-11 03:02:28 +0200
commita24fde1889125465c95c7641084252f2f389dca6 (patch)
tree6a13e8daa2dec4043bcfdd2110f2f8075ef20374 /src
parent7ccc6fa28ccacf67a46dadfa2bedb3cb950335ab (diff)
downloadmruby-a24fde1889125465c95c7641084252f2f389dca6.tar.gz
mruby-a24fde1889125465c95c7641084252f2f389dca6.zip
Define DBL_DIG only if it wasn't previously defined
DBL_DIG may already be defined on the target system, defining it without checking first may overwrite system values.
Diffstat (limited to 'src')
-rw-r--r--src/string.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/string.c b/src/string.c
index a454aab97..d8fe56790 100644
--- a/src/string.c
+++ b/src/string.c
@@ -2598,7 +2598,10 @@ mrb_cstr_to_dbl(mrb_state *mrb, const char * p, int badcheck)
double d;
// const char *ellipsis = "";
// int w;
-#define DBL_DIG 16
+#if !defined(DBL_DIG)
+ #define DBL_DIG 16
+#endif
+
enum {max_width = 20};
#define OutOfRange() (((w = end - p) > max_width) ? \
(w = max_width, ellipsis = "...") : \