Skip to content

Commit

Permalink
Merge pull request #123 from fingon/use-NAN-if-available
Browse files Browse the repository at this point in the history
nan function requires -lm on some platforms - use of NAN is better, if available
  • Loading branch information
hawicz committed Mar 22, 2014
2 parents 0eedf38 + a1c8991 commit 217bc29
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion json_tokener.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
# error You do not have strncasecmp on your system.
#endif /* HAVE_STRNCASECMP */

/* Use C99 NAN by default; if not available, nan("") should work too. */
#ifndef NAN
#define NAN nan("")
#endif /* !NAN */

static const char json_null_str[] = "null";
static const int json_null_str_len = sizeof(json_null_str) - 1;
static const char json_nan_str[] = "NaN";
Expand Down Expand Up @@ -352,7 +357,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
{
if (tok->st_pos == json_nan_str_len)
{
current = json_object_new_double(nan(""));
current = json_object_new_double(NAN);
saved_state = json_tokener_state_finish;
state = json_tokener_state_eatws;
goto redo_char;
Expand Down

0 comments on commit 217bc29

Please sign in to comment.