diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-01-21 10:08:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-21 10:08:27 +0100 |
commit | 969618ebb5bf325d01346ac0ed5d4f77fe6f668b (patch) | |
tree | fd5d38d80685f4ac5db9f48df35965767d841b38 /src/nvim/strings.c | |
parent | 53c0f0bba50f424683d281a3631aee86cce78368 (diff) | |
parent | 226352afcbbc5af703f168c1290e07add26b44fe (diff) | |
download | rneovim-969618ebb5bf325d01346ac0ed5d4f77fe6f668b.tar.gz rneovim-969618ebb5bf325d01346ac0ed5d4f77fe6f668b.tar.bz2 rneovim-969618ebb5bf325d01346ac0ed5d4f77fe6f668b.zip |
Merge #9532 from justinmk/fix-fpclassify
Diffstat (limited to 'src/nvim/strings.c')
-rw-r--r-- | src/nvim/strings.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 4921824316..96a8dfd295 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -27,6 +27,7 @@ #include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/mark.h" +#include "nvim/math.h" #include "nvim/mbyte.h" #include "nvim/memfile.h" #include "nvim/memline.h" @@ -50,16 +51,7 @@ #include "nvim/os/shell.h" #include "nvim/eval/encode.h" -#ifdef __MINGW32__ -# undef fpclassify -# define fpclassify __fpclassify -# undef isnan -# define isnan _isnan -#endif - -/* - * Copy "string" into newly allocated memory. - */ +/// Copy "string" into newly allocated memory. char_u *vim_strsave(const char_u *string) FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL { @@ -1214,14 +1206,14 @@ int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap, remove_trailing_zeroes = true; } - if (isinf(f) + if (xisinf(f) || (strchr("fF", fmt_spec) != NULL && abs_f > 1.0e307)) { xstrlcpy(tmp, infinity_str(f > 0.0, fmt_spec, force_sign, space_for_positive), sizeof(tmp)); str_arg_l = strlen(tmp); zero_padding = 0; - } else if (isnan(f)) { + } else if (xisnan(f)) { // Not a number: nan or NAN memmove(tmp, ASCII_ISUPPER(fmt_spec) ? "NAN" : "nan", 4); str_arg_l = 3; |