diff options
author | Eric Haszlakiewicz <erh+git@nimenees.com> | 2014-03-22 13:39:36 -0400 |
---|---|---|
committer | Eric Haszlakiewicz <erh+git@nimenees.com> | 2014-03-22 13:39:36 -0400 |
commit | 217bc29352de00e8cd24edb789784e1f30339414 (patch) | |
tree | 08d22175bd02ce7f459b6141df72903febdaa4ae | |
parent | 0eedf3802fad2d41e45eecd92af529440f0d7d3a (diff) | |
parent | a1c8991e135f7fbdb7d4254c699b1cf0085c23e8 (diff) | |
download | json-c-217bc29352de00e8cd24edb789784e1f30339414.tar.gz |
Merge pull request #123 from fingon/use-NAN-if-available
nan function requires -lm on some platforms - use of NAN is better, if available
-rw-r--r-- | json_tokener.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/json_tokener.c b/json_tokener.c index 0c800d8..9862f9e 100644 --- a/json_tokener.c +++ b/json_tokener.c @@ -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"; @@ -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; |