Skip to content

Commit

Permalink
isinf is available on MSVC
Browse files Browse the repository at this point in the history
At least Visual Studio 2015 (MSVC 14.0) provides the macro conforming
to C99.
  • Loading branch information
nobu committed Dec 3, 2024
1 parent 3167699 commit 6e794d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
9 changes: 1 addition & 8 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 1 addition & 7 deletions src/static_literals.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, '-');
}
Expand Down

0 comments on commit 6e794d5

Please sign in to comment.