From 6e794d5840ec2e8d59467f680618ef49d5676afd Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 3 Dec 2024 22:53:39 +0900 Subject: [PATCH] `isinf` is available on MSVC At least Visual Studio 2015 (MSVC 14.0) provides the macro conforming to C99. --- src/prism.c | 9 +-------- src/static_literals.c | 8 +------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/prism.c b/src/prism.c index 358cd04956..bc516cbf4c 100644 --- a/src/prism.c +++ b/src/prism.c @@ -4142,14 +4142,7 @@ pm_double_parse(pm_parser_t *parser, const pm_token_t *token) { // If errno is set, then it should only be ERANGE. At this point we need to // check if it's infinity (it should be). - if ( - errno == ERANGE && -#ifdef _WIN32 - !_finite(value) -#else - isinf(value) -#endif - ) { + if (errno == ERANGE && isinf(value)) { int warn_width; const char *ellipsis; diff --git a/src/static_literals.c b/src/static_literals.c index a2935db86e..b8604321c9 100644 --- a/src/static_literals.c +++ b/src/static_literals.c @@ -501,13 +501,7 @@ pm_static_literal_inspect_node(pm_buffer_t *buffer, const pm_static_literals_met case PM_FLOAT_NODE: { const double value = ((const pm_float_node_t *) node)->value; - if ( -#ifdef _WIN32 - !_finite(value) -#else - isinf(value) -#endif - ) { + if (isinf(value)) { if (*node->location.start == '-') { pm_buffer_append_byte(buffer, '-'); }