diff options
| author | emboss <[email protected]> | 2012-09-11 03:02:28 +0200 |
|---|---|---|
| committer | emboss <[email protected]> | 2012-09-11 03:02:28 +0200 |
| commit | a24fde1889125465c95c7641084252f2f389dca6 (patch) | |
| tree | 6a13e8daa2dec4043bcfdd2110f2f8075ef20374 | |
| parent | 7ccc6fa28ccacf67a46dadfa2bedb3cb950335ab (diff) | |
| download | mruby-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.
| -rw-r--r-- | src/string.c | 5 |
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 = "...") : \ |
