--- JSON-XS/XS.xs 2013/10/28 23:23:10 1.120 +++ JSON-XS/XS.xs 2014/11/24 18:42:51 1.124 @@ -19,6 +19,17 @@ # define UTF8_MAXBYTES 13 #endif +// compatibility with perl <5.18 +#ifndef HvNAMELEN_get +# define HvNAMELEN_get(hv) strlen (HvNAME (hv)) +#endif +#ifndef HvNAMELEN +# define HvNAMELEN(hv) HvNAMELEN_get (hv) +#endif +#ifndef HvNAMEUTF8 +# define HvNAMEUTF8(hv) 0 +#endif + // three extra for rounding, sign, and end of string #define IVUV_MAXCHARS (sizeof (UV) * CHAR_BIT * 28 / 93 + 3) @@ -721,7 +732,7 @@ // catch this surprisingly common error if (SvROK (TOPs) && SvRV (TOPs) == sv) - croak ("%s::TO_JSON method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv))); + croak ("%s::FREEZE method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv))); encode_ch (enc, '('); encode_ch (enc, '"'); @@ -1095,6 +1106,8 @@ utf8 = 1; } + else if (ch == '\t' && dec->json.flags & F_RELAXED) + *cur++ = ch; else { --dec_cur; @@ -1494,6 +1507,8 @@ ++dec->cur; + decode_ws (dec); + tag = decode_sv (dec); if (!tag) goto fail; @@ -1501,11 +1516,15 @@ if (!SvPOK (tag)) ERR ("malformed JSON string, (tag) must be a string"); + decode_ws (dec); + if (*dec->cur != ')') ERR (") expected after tag"); ++dec->cur; + decode_ws (dec); + val = decode_sv (dec); if (!val) goto fail;