diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-29 13:47:38 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-29 13:47:38 +0100 |
commit | 2a59b34f18c5749a504ca588d6ca91b8c2af829f (patch) | |
tree | 9405a9824d8d52c9f2802ec01faaa74ce40a8a6c /contrib | |
parent | 5b73f19bc26253b7c80a783ee100a96a644610df (diff) | |
download | rspamd-2a59b34f18c5749a504ca588d6ca91b8c2af829f.tar.gz rspamd-2a59b34f18c5749a504ca588d6ca91b8c2af829f.zip |
[Minor] Import nan support from libucl
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/libucl/ucl_parser.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/contrib/libucl/ucl_parser.c b/contrib/libucl/ucl_parser.c index fedd5065c..339b93dff 100644 --- a/contrib/libucl/ucl_parser.c +++ b/contrib/libucl/ucl_parser.c @@ -21,6 +21,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <math.h> #include "ucl.h" #include "ucl_internal.h" #include "ucl_chartable.h" @@ -1832,6 +1833,16 @@ parse_string: obj->len = 0; obj->type = UCL_NULL; } + else if (str_len == 3 && memcmp (c, "nan", 3) == 0) { + obj->len = 0; + obj->type = UCL_FLOAT; + obj->value.dv = NAN; + } + else if (str_len == 3 && memcmp (c, "inf", 3) == 0) { + obj->len = 0; + obj->type = UCL_FLOAT; + obj->value.dv = INFINITY; + } else if (!ucl_maybe_parse_boolean (obj, c, str_len)) { obj->type = UCL_STRING; if ((str_len = ucl_copy_or_store_ptr (parser, c, @@ -1842,8 +1853,8 @@ parse_string: } obj->len = str_len; } + parser->state = UCL_STATE_AFTER_VALUE; - p = chunk->pos; return true; break; |