Branch Coverage

XS.xs
Criterion Covered Total %
branch 1296 2004 64.6


line true false branch
433 57 0 if ( !cxt->mojo_boolean_stash )
435 57 0 if ( !cxt->jsonold_boolean_stash )
460 0 114 if (!SvOBJECT(sv) || !SvSTASH(sv)) {
0 0 if (!SvOBJECT(sv) || !SvSTASH(sv)) {
476 200 0 if (SvLEN (sv) > SvCUR (sv) + 1)
494 2791 0 if (LIKELY(len >= 2
1308 1483 if (LIKELY(len >= 2
1308 1483 if (LIKELY(len >= 2
1306 2 if (LIKELY(len >= 2
506 4 1481 UV c = utf8n_to_uvuni (s, len, clen,
572 0 1335 if (UNLIKELY(ch < 0x000080))
574 736 599 else if (LIKELY(ch < 0x000800))
577 267 332 else if (ch < 0x010000)
581 332 0 else if (ch < 0x110000)
596 50 303 : offset;
722 17 62 if (*s == '-')
740 17 62 return neg ? -accum : accum;
747 26 39 return (stash == gv_stashpvs ("Math::BigInt", 0) || stash == gv_stashpvs ("Math::BigFloat", 0)) ? 1 : 0;
25 1 return (stash == gv_stashpvs ("Math::BigInt", 0) || stash == gv_stashpvs ("Math::BigFloat", 0)) ? 1 : 0;
760 73 58 return (stash == bstash || stash == mstash || stash == oldstash) ? 1 : 0;
73 0 return (stash == bstash || stash == mstash || stash == oldstash) ? 1 : 0;
0 73 return (stash == bstash || stash == mstash || stash == oldstash) ? 1 : 0;
769 27 1821 if (svt < SVt_PVAV)
772 24 3 char *pv = svt ? SvPV_nomg (sv, len) : 0;
9 15 char *pv = svt ? SvPV_nomg (sv, len) : 0;
774 9 18 if (len == 1) {
775 5 4 if (*pv == '1')
777 3 1 else if (*pv == '0')
790 7 1835 if (!SvROK (scalar))
795 1821 14 if (!SvOBJECT (scalar) && ref_bool_type (aTHX_ scalar) >= 0)
0 1821 if (!SvOBJECT (scalar) && ref_bool_type (aTHX_ scalar) >= 0)
798 14 1821 if (SvOBJECT (scalar) && is_bool_obj (aTHX_ scalar))
2 12 if (SvOBJECT (scalar) && is_bool_obj (aTHX_ scalar))
826 3172 57475 if (UNLIKELY(enc->cur + len >= enc->end))
829 3172 0 SvGROW (enc->sv, cur + (len < (cur >> 2) ? cur >> 2 : len) + 1);
1863 1309 SvGROW (enc->sv, cur + (len < (cur >> 2) ? cur >> 2 : len) + 1);
859 48004 2344 while (str < end)
866 46114 1890 if (LIKELY(ch >= 0x20 && ch < 0x80)) /* most common case */
39754 6360 if (LIKELY(ch >= 0x20 && ch < 0x80)) /* most common case */
869 225 39529 if (UNLIKELY(ch == '"')) /* but with slow exceptions */
876 414 39115 else if (UNLIKELY(ch == '\\'))
883 39 39076 else if (UNLIKELY(ch == '/' && (enc->json.flags & F_ESCAPE_SLASH)))
1 38 else if (UNLIKELY(ch == '/' && (enc->json.flags & F_ESCAPE_SLASH)))
918 3637 4053 if (is_utf8 && !(enc->json.flags & F_BINARY))
1620 2017 if (is_utf8 && !(enc->json.flags & F_BINARY))
922 0 1620 if (clen == (STRLEN)-1)
931 6360 1330 if (uch < 0x80/*0x20*/ || uch >= enc->limit)
5195 1165 if (uch < 0x80/*0x20*/ || uch >= enc->limit)
933 5015 1510 if (enc->json.flags & F_BINARY)
943 320 1190 else if (uch >= 0x10000UL)
945 0 320 if (uch >= 0x110000UL)
969 8 1157 else if (enc->json.flags & F_LATIN1)
975 0 1157 else if (enc->json.flags & F_BINARY)
981 915 242 else if (is_utf8)
989 1851 915 while (--clen);
1015 32 3695 if (enc->json.flags & F_INDENT)
1034 40 3810 if (enc->json.flags & F_INDENT)
1045 8 1201 if (enc->json.flags & F_INDENT)
1047 0 1201 else if (enc->json.flags & F_SPACE_AFTER)
1059 1 896 if (enc->indent >= enc->json.max_depth)
1062 0 896 SvGETMAGIC (typesv);
0 0 SvGETMAGIC (typesv);
1064 874 22 if (UNLIKELY (SvOK (typesv)))
874 0 if (UNLIKELY (SvOK (typesv)))
0 874 if (UNLIKELY (SvOK (typesv)))
0 874 if (UNLIKELY (SvOK (typesv)))
1066 22 0 if (SvROK (typesv) &&
16 6 if (SvROK (typesv) &&
1067 11 5 SvOBJECT (SvRV (typesv)) &&
1071 11 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
11 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
11 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 11 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
11 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 11 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
1072 11 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ANYOF_CLASS)))
11 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ANYOF_CLASS)))
1076 0 11 if (UNLIKELY (!typesv_ref))
1077 0 0 croak ("incorrectly constructed anyof type (%s, 0x%x) was specified for '%s'",
0 0 croak ("incorrectly constructed anyof type (%s, 0x%x) was specified for '%s'",
1081 0 11 SvGETMAGIC (typesv);
0 0 SvGETMAGIC (typesv);
1082 0 11 if (!SvOK (typesv))
0 0 if (!SvOK (typesv))
0 0 if (!SvOK (typesv))
1083 0 0 croak ("no array alternative in anyof was specified for '%s'",
1088 0 22 if (UNLIKELY (!SvROK (typesv)))
1089 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1093 9 13 if (!SvOBJECT (SvRV (typesv)) && SvTYPE (SvRV (typesv)) == SVt_PVAV)
9 0 if (!SvOBJECT (SvRV (typesv)) && SvTYPE (SvRV (typesv)) == SVt_PVAV)
1096 0 9 if (len != av_len (typeav))
1097 0 0 croak ("array '%s' has different number of elements as in specified type '%s'",
0 0 croak ("array '%s' has different number of elements as in specified type '%s'",
1101 13 0 else if (SvOBJECT (SvRV (typesv)) &&
13 0 else if (SvOBJECT (SvRV (typesv)) &&
1105 13 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
13 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
13 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 13 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
13 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 13 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
1106 13 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ARRAYOF_CLASS)))
13 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ARRAYOF_CLASS)))
1109 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1114 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1121 886 10 if (len >= 0)
1125 1732 871 for (i = 0; i <= len; ++i)
1129 23 1709 if (typeav)
1132 23 0 if (typerv)
1138 1730 2 if (svp)
1143 846 871 if (i < len)
1158 1 745 if (He_IS_SVKEY(he))
1161 1 0 SV *sv = HeSVKEY (he);
1 0 SV *sv = HeSVKEY (he);
1162 1 0 *key = SvPV (sv, len);
1173 4 742 if (utf8) *klen = -(*klen);
1183 7 739 if (enc->json.flags & F_SPACE_BEFORE) encode_space (aTHX_ enc);
1185 7 739 if (enc->json.flags & F_SPACE_AFTER ) encode_space (aTHX_ enc);
1200 198 112 if (!(cmp = memcmp (HeKEY (b), HeKEY (a), lb < la ? lb : la)))
1211 357 0 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
0 357 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
4 353 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
357 0 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
0 357 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
7 350 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
1220 1 393 if (enc->indent >= enc->json.max_depth)
1223 0 393 SvGETMAGIC (typesv);
0 0 SvGETMAGIC (typesv);
1225 376 17 if (UNLIKELY (SvOK (typesv)))
376 0 if (UNLIKELY (SvOK (typesv)))
0 376 if (UNLIKELY (SvOK (typesv)))
0 376 if (UNLIKELY (SvOK (typesv)))
1227 17 0 if (SvROK (typesv) &&
6 11 if (SvROK (typesv) &&
1228 4 2 SvOBJECT (SvRV (typesv)) &&
1232 4 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
4 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
4 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 4 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
4 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 4 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
1233 4 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ANYOF_CLASS)))
4 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ANYOF_CLASS)))
1237 0 4 if (UNLIKELY (!typesv_ref))
1238 0 0 croak ("incorrectly constructed anyof type (%s, 0x%x) was specified for '%s'",
0 0 croak ("incorrectly constructed anyof type (%s, 0x%x) was specified for '%s'",
1242 0 4 SvGETMAGIC (typesv);
0 0 SvGETMAGIC (typesv);
1243 0 4 if (!SvOK (typesv))
0 0 if (!SvOK (typesv))
0 0 if (!SvOK (typesv))
1244 0 0 croak ("no hash alternative in anyof was specified for '%s'",
1249 0 17 if (UNLIKELY (!SvROK (typesv)))
1250 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1254 13 4 if (!SvOBJECT (SvRV (typesv)) && SvTYPE (SvRV (typesv)) == SVt_PVHV)
13 0 if (!SvOBJECT (SvRV (typesv)) && SvTYPE (SvRV (typesv)) == SVt_PVHV)
1256 4 0 else if (SvOBJECT (SvRV (typesv)) &&
4 0 else if (SvOBJECT (SvRV (typesv)) &&
1260 4 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
4 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
4 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 4 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
4 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 4 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
1261 4 0 if (LIKELY (name && strEQ (name, JSON_TYPE_HASHOF_CLASS)))
4 0 if (LIKELY (name && strEQ (name, JSON_TYPE_HASHOF_CLASS)))
1264 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1269 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1279 239 154 if (enc->json.flags & F_CANONICAL && !SvTIED_mg((SV*)hv, PERL_MAGIC_tied))
0 239 if (enc->json.flags & F_CANONICAL && !SvTIED_mg((SV*)hv, PERL_MAGIC_tied))
0 0 if (enc->json.flags & F_CANONICAL && !SvTIED_mg((SV*)hv, PERL_MAGIC_tied))
1283 0 239 if (SvMAGICAL (hv))
1291 0 0 while (hv_iternext (hv))
1297 233 6 if (count)
1304 0 233 if (count > STACK_HES)
1311 584 233 while ((he = hv_iternext (hv)))
1314 584 0 if (HeKLEN (he) < 0 || HeKUTF8 (he))
3 581 if (HeKLEN (he) < 0 || HeKUTF8 (he))
1320 230 3 if (fast)
1336 3 0 FREETMPS;
1342 584 232 while (count--)
1352 29 555 if (UNLIKELY (PTR2ul (typehv)))
1355 0 29 if (UNLIKELY (!typesv_ref))
1361 0 584 encode_sv (aTHX_ enc, UNLIKELY(SvMAGICAL (hv)) ? hv_iterval (hv, he) : HeVAL (he), typesv);
1363 351 232 if (count)
1372 5 149 if (hv_iterinit (hv) || SvMAGICAL (hv))
1 4 if (hv_iterinit (hv) || SvMAGICAL (hv))
1373 150 0 if ((he = hv_iternext (hv)))
1386 0 162 if (UNLIKELY (PTR2ul (typehv)))
1389 0 0 if (UNLIKELY (!typesv_ref))
1395 1 161 encode_sv (aTHX_ enc, UNLIKELY(SvMAGICAL (hv)) ? hv_iterval (hv, he) : HeVAL (he), typesv);
1397 146 12 if (!(he = hv_iternext (hv)))
1435 9 2 if (isref && SvAMAGIC(sv))
9 0 if (isref && SvAMAGIC(sv))
9 0 if (isref && SvAMAGIC(sv))
9 0 if (isref && SvAMAGIC(sv))
1438 2 0 else if (!MyAMG(sv) && !(enc->json.flags & F_ALLOW_STRINGIFY)) {
2 0 else if (!MyAMG(sv) && !(enc->json.flags & F_ALLOW_STRINGIFY)) {
2 0 else if (!MyAMG(sv) && !(enc->json.flags & F_ALLOW_STRINGIFY)) {
1439 0 2 if (isref && !(enc->json.flags & F_ALLOW_UNKNOWN))
0 0 if (isref && !(enc->json.flags & F_ALLOW_UNKNOWN))
1440 0 0 croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or 1",
1446 9 0 if (type != SVt_PVAV && type != SVt_PVHV && type != SVt_PVFM) {
9 0 if (type != SVt_PVAV && type != SVt_PVHV && type != SVt_PVFM) {
9 0 if (type != SVt_PVAV && type != SVt_PVHV && type != SVt_PVFM) {
1451 0 9 SvSETMAGIC(pv);
1452 0 9 str = SvPVutf8_force(pv, len);
1473 0 9 if (!len) {
1480 0 0 if (SvGMAGICAL(sv)) mg_get(sv);
1481 0 0 if (MyAMG(sv)) { /* force a RV here */
0 0 if (MyAMG(sv)) { /* force a RV here */
1496 0 0 TAINT_IF(pv && SvTAINTED(pv));
0 0 TAINT_IF(pv && SvTAINTED(pv));
0 0 TAINT_IF(pv && SvTAINTED(pv));
0 0 TAINT_IF(pv && SvTAINTED(pv));
1497 0 0 if (pv && SvPOK(pv)) {
0 0 if (pv && SvPOK(pv)) {
1498 0 0 str = SvPVutf8_force(pv, len);
1508 9 0 if (UNLIKELY(isref == 1 && (enc->json.flags & F_ALLOW_BIGNUM) && str && str[0] == '+')) {
9 0 if (UNLIKELY(isref == 1 && (enc->json.flags & F_ALLOW_BIGNUM) && str && str[0] == '+')) {
9 0 if (UNLIKELY(isref == 1 && (enc->json.flags & F_ALLOW_BIGNUM) && str && str[0] == '+')) {
9 0 if (UNLIKELY(isref == 1 && (enc->json.flags & F_ALLOW_BIGNUM) && str && str[0] == '+')) {
9 0 if (UNLIKELY(isref == 1 && (enc->json.flags & F_ALLOW_BIGNUM) && str && str[0] == '+')) {
0 9 if (UNLIKELY(isref == 1 && (enc->json.flags & F_ALLOW_BIGNUM) && str && str[0] == '+')) {
1513 9 0 if (UNLIKELY(
9 0 if (UNLIKELY(
9 0 if (UNLIKELY(
9 0 if (UNLIKELY(
9 0 if (UNLIKELY(
6 3 if (UNLIKELY(
0 6 if (UNLIKELY(
6 3 if (UNLIKELY(
2 4 if (UNLIKELY(
4 5 if (UNLIKELY(
2 2 if (UNLIKELY(
7 2 if (UNLIKELY(
1520 7 0 if (is_bignum_obj (aTHX_ SvRV (sv)))
1522 4 3 if (enc->json.infnan_mode == 0) {
1524 4 0 if (pv) SvREFCNT_dec(pv);
1526 3 0 } else if (enc->json.infnan_mode == 3) {
1527 2 1 if (memEQc(str, "NaN") || memEQc(str, "nan"))
0 2 if (memEQc(str, "NaN") || memEQc(str, "nan"))
1529 1 1 else if (memEQc(str, "inf"))
1533 3 0 if (pv) SvREFCNT_dec(pv);
1538 0 2 if (!str)
1541 0 2 if (isref != 1)
1544 0 2 if (isref != 1)
1553 37 28 if (is_bool_obj (aTHX_ sv))
1555 3 34 if (as_string)
1557 37 0 if (SvIV_nomg (sv))
21 16 if (SvIV_nomg (sv))
1561 3 34 if (as_string)
1564 0 28 else if (force_conversion && enc->json.flags & F_CONV_BLESSED)
0 0 else if (force_conversion && enc->json.flags & F_CONV_BLESSED)
1566 0 0 if (as_string)
1568 0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
0 0 if (SvTRUE_nomg (sv))
1572 0 0 if (as_string)
1586 5 22 if (bool_type == 1)
1588 3 19 else if (bool_type == 0)
1608 53 29 if (UNLIKELY (SvOBJECT (sv)))
1610 28 25 if (!encode_bool_obj (aTHX_ enc, sv, 0, 0))
1613 7 21 if ((enc->json.flags & F_ALLOW_TAGS)
1614 6 1 && (method = gv_fetchmethod_autoload (stash, "FREEZE", 0)))
1620 0 6 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
0 6 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
1621 0 6 EXTEND (SP, 2);
1631 2 4 if (SvROK (TOPs) && SvRV (TOPs) == sv)
0 2 if (SvROK (TOPs) && SvRV (TOPs) == sv)
1632 0 0 croak ("%s::FREEZE method returned same object as was passed instead of a new one",
0 0 croak ("%s::FREEZE method returned same object as was passed instead of a new one",
1633 0 0 HvNAME (SvSTASH (sv)));
0 0 HvNAME (SvSTASH (sv)));
0 0 HvNAME (SvSTASH (sv)));
0 0 HvNAME (SvSTASH (sv)));
1637 6 0 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
6 0 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 6 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 0 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
6 0 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 6 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 6 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
6 0 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
6 0 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 6 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 0 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
6 0 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 6 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
6 0 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
6 0 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 6 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 0 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
6 0 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 6 encode_str (aTHX_ enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
1642 255 6 while (count)
1647 249 6 if (count)
1656 6 0 FREETMPS; LEAVE;
1658 18 4 else if ((enc->json.flags & F_CONV_BLESSED)
1659 7 11 && (method = gv_fetchmethod_autoload (stash, "TO_JSON", 0)))
1663 0 7 ENTER; SAVETMPS; PUSHMARK (SP);
1665 0 7 XPUSHs (rv);
1673 3 4 if (SvROK (TOPs) && SvRV (TOPs) == sv)
1 2 if (SvROK (TOPs) && SvRV (TOPs) == sv)
1674 1 0 croak ("%s::TO_JSON method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv)));
1 0 croak ("%s::TO_JSON method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv)));
0 1 croak ("%s::TO_JSON method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv)));
0 0 croak ("%s::TO_JSON method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv)));
1 0 croak ("%s::TO_JSON method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv)));
0 1 croak ("%s::TO_JSON method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv)));
1681 6 0 FREETMPS; LEAVE;
1683 9 6 else if ((enc->json.flags & F_ALLOW_BIGNUM) && is_bignum_obj (aTHX_ sv))
9 0 else if ((enc->json.flags & F_ALLOW_BIGNUM) && is_bignum_obj (aTHX_ sv))
1685 2 4 else if (enc->json.flags & F_CONV_BLESSED)
1687 2 2 else if (enc->json.flags & F_ALLOW_BLESSED)
1690 0 2 croak ("encountered object '%s', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing)",
1694 26 3 else if (svt < SVt_PVAV && svt != SVt_PVGV && svt != SVt_PVHV && svt != SVt_PVAV)
24 2 else if (svt < SVt_PVAV && svt != SVt_PVGV && svt != SVt_PVHV && svt != SVt_PVAV)
24 0 else if (svt < SVt_PVAV && svt != SVt_PVGV && svt != SVt_PVHV && svt != SVt_PVAV)
24 0 else if (svt < SVt_PVAV && svt != SVt_PVGV && svt != SVt_PVHV && svt != SVt_PVAV)
1696 19 5 if (!encode_bool_ref (aTHX_ enc, sv))
1698 0 19 if (enc->json.flags & F_ALLOW_STRINGIFY)
1700 7 12 else if (enc->json.flags & F_ALLOW_UNKNOWN)
1703 0 12 croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or 1",
1707 2 3 else if (enc->json.flags & F_ALLOW_UNKNOWN)
1710 0 3 croak ("encountered %s, but JSON can only represent references to arrays or hashes",
1719 95 12 if (!SvROK (sv))
1721 8 87 if (UNLIKELY (sv == &PL_sv_yes))
1723 6 81 else if (UNLIKELY (sv == &PL_sv_no))
1725 1 80 else if (!SvOK (sv))
1 0 else if (!SvOK (sv))
1 0 else if (!SvOK (sv))
1727 80 0 else if (SvTRUE_nomg (sv))
0 80 else if (SvTRUE_nomg (sv))
0 0 else if (SvTRUE_nomg (sv))
0 0 else if (SvTRUE_nomg (sv))
46 34 else if (SvTRUE_nomg (sv))
46 0 else if (SvTRUE_nomg (sv))
15 31 else if (SvTRUE_nomg (sv))
12 3 else if (SvTRUE_nomg (sv))
6 6 else if (SvTRUE_nomg (sv))
37 9 else if (SvTRUE_nomg (sv))
34 0 else if (SvTRUE_nomg (sv))
18 16 else if (SvTRUE_nomg (sv))
2 16 else if (SvTRUE_nomg (sv))
16 2 else if (SvTRUE_nomg (sv))
12 4 else if (SvTRUE_nomg (sv))
28 6 else if (SvTRUE_nomg (sv))
0 0 else if (SvTRUE_nomg (sv))
1737 9 3 if (UNLIKELY (SvOBJECT (sv)))
1739 0 9 if (!encode_bool_obj (aTHX_ enc, sv, 1, 0))
1740 0 0 croak ("encountered object '%s', but convert_blessed is not enabled",
1743 3 0 else if (svt < SVt_PVAV && svt != SVt_PVGV)
3 0 else if (svt < SVt_PVAV && svt != SVt_PVGV)
1745 0 3 if (!encode_bool_ref (aTHX_ enc, sv))
1746 0 0 croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or 1",
1750 0 0 croak ("encountered %s, but does not represent boolean",
1758 0 31 *iv = SvIV_nomg (sv);
1762 9 22 if (!*is_neg)
1764 0 9 *uv = SvUV_nomg (sv);
1777 3 4087 SvGETMAGIC (sv);
0 3 SvGETMAGIC (sv);
1779 3656 434 if (UNLIKELY (!(SvOK (typesv)) && (enc->json.flags & F_REQUIRE_TYPES)))
3656 0 if (UNLIKELY (!(SvOK (typesv)) && (enc->json.flags & F_REQUIRE_TYPES)))
3656 0 if (UNLIKELY (!(SvOK (typesv)) && (enc->json.flags & F_REQUIRE_TYPES)))
3656 0 if (UNLIKELY (!(SvOK (typesv)) && (enc->json.flags & F_REQUIRE_TYPES)))
3656 434 if (UNLIKELY (!(SvOK (typesv)) && (enc->json.flags & F_REQUIRE_TYPES)))
8 3648 if (UNLIKELY (!(SvOK (typesv)) && (enc->json.flags & F_REQUIRE_TYPES)))
1780 0 8 croak ("type for '%s' was not specified", SvPV_nolen (sv));
1782 1428 2654 if (SvROK (sv) && !SvOBJECT (SvRV (sv)))
1323 105 if (SvROK (sv) && !SvOBJECT (SvRV (sv)))
1785 394 929 if (svt == SVt_PVHV)
1790 897 32 else if (svt == SVt_PVAV)
1797 0 2791 SvGETMAGIC (typesv);
0 0 SvGETMAGIC (typesv);
1799 2396 395 if (UNLIKELY (SvOK (typesv)))
2396 0 if (UNLIKELY (SvOK (typesv)))
0 2396 if (UNLIKELY (SvOK (typesv)))
0 2396 if (UNLIKELY (SvOK (typesv)))
1801 55 340 if (SvROK (sv) && SvOBJECT (SvRV (sv)) && !(enc->json.flags & (F_ALLOW_TAGS|F_CONV_BLESSED|F_ALLOW_BLESSED)) && !is_bool_obj (aTHX_ SvRV (sv)) && !is_bignum_obj (aTHX_ SvRV (sv)))
52 3 if (SvROK (sv) && SvOBJECT (SvRV (sv)) && !(enc->json.flags & (F_ALLOW_TAGS|F_CONV_BLESSED|F_ALLOW_BLESSED)) && !is_bool_obj (aTHX_ SvRV (sv)) && !is_bignum_obj (aTHX_ SvRV (sv)))
52 0 if (SvROK (sv) && SvOBJECT (SvRV (sv)) && !(enc->json.flags & (F_ALLOW_TAGS|F_CONV_BLESSED|F_ALLOW_BLESSED)) && !is_bool_obj (aTHX_ SvRV (sv)) && !is_bignum_obj (aTHX_ SvRV (sv)))
33 19 if (SvROK (sv) && SvOBJECT (SvRV (sv)) && !(enc->json.flags & (F_ALLOW_TAGS|F_CONV_BLESSED|F_ALLOW_BLESSED)) && !is_bool_obj (aTHX_ SvRV (sv)) && !is_bignum_obj (aTHX_ SvRV (sv)))
1 32 if (SvROK (sv) && SvOBJECT (SvRV (sv)) && !(enc->json.flags & (F_ALLOW_TAGS|F_CONV_BLESSED|F_ALLOW_BLESSED)) && !is_bool_obj (aTHX_ SvRV (sv)) && !is_bignum_obj (aTHX_ SvRV (sv)))
1802 0 1 croak ("encountered object '%s', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing)", SvPV_nolen (sv));
1804 83 311 if (!SvIOKp (typesv))
1806 83 0 if (SvROK (typesv) &&
83 0 if (SvROK (typesv) &&
1807 83 0 SvOBJECT (SvRV (typesv)) &&
1811 83 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
83 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
83 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 83 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
83 0 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
0 83 char *name = LIKELY (!!stash) ? HvNAME (stash) : NULL;
1812 83 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ANYOF_CLASS)))
83 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ANYOF_CLASS)))
1816 0 83 if (UNLIKELY (!typesv_ref))
1817 0 0 croak ("incorrectly constructed anyof type (%s, 0x%x) was specified for '%s'",
0 0 croak ("incorrectly constructed anyof type (%s, 0x%x) was specified for '%s'",
1821 0 83 SvGETMAGIC (typesv);
0 0 SvGETMAGIC (typesv);
1822 0 83 if (!SvIOKp (typesv))
1823 0 0 croak ("no scalar alternative in anyof was specified for '%s'", SvPV_nolen (sv));
1826 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1831 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1838 392 2398 if (UNLIKELY (type))
1846 2394 4 if (UNLIKELY (sv == &PL_sv_yes || sv == &PL_sv_no)) type = JSON_TYPE_BOOL;
4 2390 if (UNLIKELY (sv == &PL_sv_yes || sv == &PL_sv_no)) type = JSON_TYPE_BOOL;
1847 80 2310 else if (SvNOKp (sv)) type = JSON_TYPE_FLOAT;
1848 872 1438 else if (SvIOKp (sv)) type = JSON_TYPE_INT;
1849 1314 124 else if (SvPOKp (sv)) type = JSON_TYPE_STRING;
1850 82 42 else if (SvROK (sv)) process_ref = 1;
1851 42 0 else if (!SvOK (sv)) can_be_null = 1;
42 0 else if (!SvOK (sv)) can_be_null = 1;
42 0 else if (!SvOK (sv)) can_be_null = 1;
1854 150 2640 if (can_be_null && !SvOK (sv))
55 95 if (can_be_null && !SvOK (sv))
55 0 if (can_be_null && !SvOK (sv))
55 0 if (can_be_null && !SvOK (sv))
1856 107 2628 else if (type == JSON_TYPE_BOOL)
1858 163 2465 else if (type == JSON_TYPE_FLOAT)
1874 19 144 if (UNLIKELY (SvROK (sv) && SvOBJECT (SvRV (sv))) && (enc->json.flags & F_ALLOW_BIGNUM) && is_bignum_obj (aTHX_ SvRV (sv)))
19 0 if (UNLIKELY (SvROK (sv) && SvOBJECT (SvRV (sv))) && (enc->json.flags & F_ALLOW_BIGNUM) && is_bignum_obj (aTHX_ SvRV (sv)))
16 3 if (UNLIKELY (SvROK (sv) && SvOBJECT (SvRV (sv))) && (enc->json.flags & F_ALLOW_BIGNUM) && is_bignum_obj (aTHX_ SvRV (sv)))
16 0 if (UNLIKELY (SvROK (sv) && SvOBJECT (SvRV (sv))) && (enc->json.flags & F_ALLOW_BIGNUM) && is_bignum_obj (aTHX_ SvRV (sv)))
1877 16 147 if (UNLIKELY (is_bigobj))
1880 0 16 char *str = SvPV_nomg (sv, len);
1881 0 16 if (UNLIKELY (str[0] == '+'))
1886 14 2 if (UNLIKELY (memEQc (str, "NaN") || memEQc (str, "nan")))
0 14 if (UNLIKELY (memEQc (str, "NaN") || memEQc (str, "nan")))
1891 2 12 else if (UNLIKELY (memEQc (str, "inf")))
1896 2 10 else if (UNLIKELY (memEQc (str, "-inf")))
1910 118 29 else if (SvNOKp (sv))
1916 15 14 if (enc->json.flags & F_ALLOW_BIGNUM)
1924 15 0 str = SvPV_nomg (sv, len);
1927 2 13 if (UNLIKELY (numtype & IS_NUMBER_INFINITY))
1928 1 1 nv = (numtype & IS_NUMBER_NEG) ? -NV_INF : NV_INF;
1929 1 12 else if (UNLIKELY (numtype & IS_NUMBER_NAN))
1931 0 12 else if (UNLIKELY (!numtype))
1932 0 0 nv = SvNV_nomg (sv);
1943 12 0 errsv = ERRSV;
1944 0 12 if (SvROK (errsv))
1946 12 0 else if (SvTRUE (errsv))
0 12 else if (SvTRUE (errsv))
0 12 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
12 0 else if (SvTRUE (errsv))
12 0 else if (SvTRUE (errsv))
12 0 else if (SvTRUE (errsv))
0 12 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 12 else if (SvTRUE (errsv))
1955 0 12 str = SvPV (pv, len);
1956 0 12 if (UNLIKELY (str[0] == '+'))
1988 0 14 nv = SvNV_nomg (sv);
1993 141 22 if (LIKELY (!is_bigobj))
2000 61 80 if (force_conversion)
2006 16 45 if (UNLIKELY(isinf(nv)))
2008 8 8 nv = (nv > 0) ? NV_MAX : -NV_MAX;
2012 6 55 if (UNLIKELY(isnan(nv)))
2017 63 17 else if (enc->json.infnan_mode == 0)
2022 2 61 if (UNLIKELY(isinf(nv)))
2025 1 1 inf_or_nan = (nv > 0) ? 1 : 2;
2031 3 58 if (UNLIKELY(isnan(nv)))
2086 3 133 if (UNLIKELY(strEQc(enc->cur, STR_INF)))
2107 3 130 (UNLIKELY(strEQc(enc->cur, STR_NAN)))
2110 25 105 else if (*enc->cur == '-') {
2120 3 22 if (UNLIKELY(strEQc(enc->cur+1, STR_INF)))
2135 6 16 (UNLIKELY(strEQc(enc->cur+1, STR_NAN)))
2139 15 121 if (UNLIKELY(inf_or_nan)) {
2141 5 15 if (enc->json.infnan_mode == 0) {
2144 5 10 else if (enc->json.infnan_mode == 1) {
2151 5 5 else if (enc->json.infnan_mode == 3) {
2152 1 4 if (inf_or_nan == 1)
2154 1 3 else if (inf_or_nan == 2)
2156 3 0 else if (inf_or_nan == 3)
2159 0 5 else if (enc->json.infnan_mode != 2) {
2167 80 83 if (!force_conversion && SvPOKp (sv) && !strEQ(enc->cur, SvPVX (sv))) {
6 74 if (!force_conversion && SvPOKp (sv) && !strEQ(enc->cur, SvPVX (sv))) {
4 2 if (!force_conversion && SvPOKp (sv) && !strEQ(enc->cur, SvPVX (sv))) {
2179 139 20 if (!( inf_or_nan || (had_nokp && Perl_modf(SvNVX(sv), &intpart)) || (!force_conversion && SvIOK(sv))
56 83 if (!( inf_or_nan || (had_nokp && Perl_modf(SvNVX(sv), &intpart)) || (!force_conversion && SvIOK(sv))
31 25 if (!( inf_or_nan || (had_nokp && Perl_modf(SvNVX(sv), &intpart)) || (!force_conversion && SvIOK(sv))
31 83 if (!( inf_or_nan || (had_nokp && Perl_modf(SvNVX(sv), &intpart)) || (!force_conversion && SvIOK(sv))
25 6 if (!( inf_or_nan || (had_nokp && Perl_modf(SvNVX(sv), &intpart)) || (!force_conversion && SvIOK(sv))
73 12 if (!( inf_or_nan || (had_nokp && Perl_modf(SvNVX(sv), &intpart)) || (!force_conversion && SvIOK(sv))
2180 85 23 || strchr(enc->cur,'e') || strchr(enc->cur,'E') || strchr(savecur,'.')
85 0 || strchr(enc->cur,'e') || strchr(enc->cur,'E') || strchr(savecur,'.')
2194 1014 1451 else if (type == JSON_TYPE_INT)
2204 20 994 if (UNLIKELY (SvROK (sv) && SvOBJECT (SvRV (sv))) && (enc->json.flags & F_ALLOW_BIGNUM))
20 0 if (UNLIKELY (SvROK (sv) && SvOBJECT (SvRV (sv))) && (enc->json.flags & F_ALLOW_BIGNUM))
16 4 if (UNLIKELY (SvROK (sv) && SvOBJECT (SvRV (sv))) && (enc->json.flags & F_ALLOW_BIGNUM))
2207 16 0 int is_bigint = (stash && stash == gv_stashpvs ("Math::BigInt", 0));
8 8 int is_bigint = (stash && stash == gv_stashpvs ("Math::BigInt", 0));
2208 16 0 int is_bigfloat = (stash && stash == gv_stashpvs ("Math::BigFloat", 0));
8 8 int is_bigfloat = (stash && stash == gv_stashpvs ("Math::BigFloat", 0));
2210 8 8 if (is_bigint || is_bigfloat)
8 0 if (is_bigint || is_bigfloat)
2215 8 8 if (is_bigfloat)
2223 0 8 PUSHMARK (SP);
2224 0 8 XPUSHs (sv);
2230 8 0 is_negative = SvTRUEx (POPs);
0 8 is_negative = SvTRUEx (POPs);
0 0 is_negative = SvTRUEx (POPs);
0 8 is_negative = SvTRUEx (POPs);
0 0 is_negative = SvTRUEx (POPs);
0 0 is_negative = SvTRUEx (POPs);
0 8 is_negative = SvTRUEx (POPs);
0 0 is_negative = SvTRUEx (POPs);
0 0 is_negative = SvTRUEx (POPs);
0 0 is_negative = SvTRUEx (POPs);
0 0 is_negative = SvTRUEx (POPs);
0 0 is_negative = SvTRUEx (POPs);
8 0 is_negative = SvTRUEx (POPs);
8 0 is_negative = SvTRUEx (POPs);
5 3 is_negative = SvTRUEx (POPs);
0 5 is_negative = SvTRUEx (POPs);
0 0 is_negative = SvTRUEx (POPs);
3 5 is_negative = SvTRUEx (POPs);
0 0 is_negative = SvTRUEx (POPs);
2233 0 8 PUSHMARK (SP);
2234 0 8 XPUSHs (sv);
2242 3 5 call_method (is_negative ? "bceil" : "bfloor", G_SCALAR);
2249 0 16 str = SvPV_nomg (sv, len);
2250 0 16 if (UNLIKELY (str[0] == '+'))
2256 14 2 if (UNLIKELY (strEQc (str, "NaN") || strEQc (str, "nan")))
0 14 if (UNLIKELY (strEQc (str, "NaN") || strEQc (str, "nan")))
2260 2 12 else if (UNLIKELY (strEQc (str, "inf")))
2267 2 10 else if (UNLIKELY (strEQc (str, "-inf")))
2284 8 8 if (is_bigfloat)
2286 8 0 FREETMPS;
2294 915 83 if (SvIOK (sv))
2300 56 27 else if (SvPOKp (sv))
2303 42 14 if (numtype & IS_NUMBER_IN_UV)
2305 10 32 if (numtype & IS_NUMBER_NEG)
2308 3 7 if (LIKELY(uv <= (UV)(IV_MAX) + 1))
2320 2 12 else if (UNLIKELY (numtype & IS_NUMBER_INFINITY))
2323 1 1 if (is_neg)
2335 20 36 if ((numtype & (IS_NUMBER_GREATER_THAN_UV_MAX|IS_NUMBER_NOT_INT)) && (enc->json.flags & F_ALLOW_BIGNUM))
12 8 if ((numtype & (IS_NUMBER_GREATER_THAN_UV_MAX|IS_NUMBER_NOT_INT)) && (enc->json.flags & F_ALLOW_BIGNUM))
2342 6 6 if (numtype & IS_NUMBER_NOT_INT)
2349 6 6 if (numtype & IS_NUMBER_NOT_INT)
2363 12 0 errsv = ERRSV;
2364 0 12 if (SvROK (errsv))
2366 12 0 else if (SvTRUE (errsv))
0 12 else if (SvTRUE (errsv))
0 12 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
12 0 else if (SvTRUE (errsv))
12 0 else if (SvTRUE (errsv))
12 0 else if (SvTRUE (errsv))
0 12 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 12 else if (SvTRUE (errsv))
2375 0 12 str = SvPV (pv, len);
2376 0 12 if (UNLIKELY (str[0] == '+'))
2390 4 40 else if (!(numtype & (IS_NUMBER_IN_UV|IS_NUMBER_INFINITY|IS_NUMBER_NAN)))
2425 943 43 if (is_neg ? iv <= 59000 && iv >= -59000
940 3 if (is_neg ? iv <= 59000 && iv >= -59000
930 10 if (is_neg ? iv <= 59000 && iv >= -59000
957 29 if (is_neg ? iv <= 59000 && iv >= -59000
2439 10 947 *enc->cur = '-'; enc->cur += i < 0 ? 1 : 0;
2450 957 0 digit = u >> 28; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0xfffffffUL) * 5;
7 950 digit = u >> 28; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0xfffffffUL) * 5;
2451 950 7 digit = u >> 27; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0x7ffffffUL) * 5;
4 946 digit = u >> 27; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0x7ffffffUL) * 5;
2452 946 11 digit = u >> 26; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0x3ffffffUL) * 5;
5 941 digit = u >> 26; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0x3ffffffUL) * 5;
2453 941 16 digit = u >> 25; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0x1ffffffUL) * 5;
68 873 digit = u >> 25; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0x1ffffffUL) * 5;
2466 16 13 : snprintf (enc->cur, IVUV_MAXCHARS, "%" IVdf, iv);
2469 872 114 if (!force_conversion && SvPOKp (sv) && !strEQ(savecur, SvPVX (sv))) {
19 853 if (!force_conversion && SvPOKp (sv) && !strEQ(savecur, SvPVX (sv))) {
1 18 if (!force_conversion && SvPOKp (sv) && !strEQ(savecur, SvPVX (sv))) {
2480 1369 82 else if (type == JSON_TYPE_STRING)
2482 0 1369 if (UNLIKELY (sv == &PL_sv_yes))
2488 0 1369 else if (UNLIKELY (sv == &PL_sv_no))
2494 3 1366 else if (!UNLIKELY (SvROK(sv) && SvOBJECT (SvRV(sv))) || !encode_bool_obj (aTHX_ enc, SvRV(sv), 0, 1))
3 0 else if (!UNLIKELY (SvROK(sv) && SvOBJECT (SvRV(sv))) || !encode_bool_obj (aTHX_ enc, SvRV(sv), 0, 1))
0 3 else if (!UNLIKELY (SvROK(sv) && SvOBJECT (SvRV(sv))) || !encode_bool_obj (aTHX_ enc, SvRV(sv), 0, 1))
2498 1351 15 if (SvPOKp (sv))
2505 0 15 str = SvPV_nomg (sv, len);
2512 82 0 else if (process_ref)
2514 0 0 else if (enc->json.flags & F_ALLOW_UNKNOWN)
2517 0 0 croak ("encountered perl type (%s,0x%x) that JSON cannot handle, check your input data",
2526 957 396 if (!(json->flags & F_ALLOW_NONREF) && json_nonref (aTHX_ scalar))
0 957 if (!(json->flags & F_ALLOW_NONREF) && json_nonref (aTHX_ scalar))
2535 1241 112 : enc.json.flags & F_BINARY ? 0x000080UL
2536 1038 203 : enc.json.flags & F_LATIN1 ? 0x000100UL
2537 5 1033 : 0x110000UL;
2546 674 650 if (!(enc.json.flags & (F_ASCII | F_LATIN1 | F_BINARY | F_UTF8)))
2549 200 1124 if (enc.json.flags & F_SHRINK)
2574 47 0 while (*dec->cur && *dec->cur != 0x0a && *dec->cur != 0x0d)
38 9 while (*dec->cur && *dec->cur != 0x0a && *dec->cur != 0x0d)
38 0 while (*dec->cur && *dec->cur != 0x0a && *dec->cur != 0x0d)
2585 31974 56223 if (ch > 0x20)
2587 11 31963 if (UNLIKELY(ch == '#'))
2589 9 2 if (dec->json.flags & F_RELAXED)
2597 6852 49371 else if (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)
865 5987 else if (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)
865 0 else if (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)
863 2 else if (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)
3147 3 2141 d1 = decode_hexdigit [cur [0]]; if (UNLIKELY(d1 < 0)) ERR ("exactly four hexadecimal digits expected");
3148 2 2139 d2 = decode_hexdigit [cur [1]]; if (UNLIKELY(d2 < 0)) ERR ("exactly four hexadecimal digits expected");
3149 1 2138 d3 = decode_hexdigit [cur [2]]; if (UNLIKELY(d3 < 0)) ERR ("exactly four hexadecimal digits expected");
3150 1 2137 d4 = decode_hexdigit [cur [3]]; if (UNLIKELY(d4 < 0)) ERR ("exactly four hexadecimal digits expected");
3169 0 2506 d1 = decode_hexdigit [cur [0]]; if (UNLIKELY(d1 < 0)) ERR ("exactly two hexadecimal digits expected");
3170 0 2506 d2 = decode_hexdigit [cur [1]]; if (UNLIKELY(d2 < 0)) ERR ("exactly two hexadecimal digits expected");
3184 0 0 d1 = (IV)(cur[0] - '0'); if (d1 < 0 || d1 > 7) ERR ("exactly three octal digits expected");
0 0 d1 = (IV)(cur[0] - '0'); if (d1 < 0 || d1 > 7) ERR ("exactly three octal digits expected");
3185 0 0 d2 = (IV)(cur[1] - '0'); if (d2 < 0 || d2 > 7) ERR ("exactly three octal digits expected");
0 0 d2 = (IV)(cur[1] - '0'); if (d2 < 0 || d2 > 7) ERR ("exactly three octal digits expected");
3186 0 0 d3 = (IV)(cur[2] - '0'); if (d3 < 0 || d3 > 7) ERR ("exactly three octal digits expected");
0 0 d3 = (IV)(cur[2] - '0'); if (d3 < 0 || d3 > 7) ERR ("exactly three octal digits expected");
3211 4934 115305 if (UNLIKELY(ch == endstr))
3213 7 4927 if (ch == 0x27 && !(dec->json.flags & F_ALLOW_SQUOTE)) {
0 7 if (ch == 0x27 && !(dec->json.flags & F_ALLOW_SQUOTE)) {
3219 5436 109869 else if (UNLIKELY(ch == '\\'))
3236 2 2506 if (!(dec->json.flags & F_BINARY))
3241 0 2506 if (c == (UV)-1)
3251 1 0 if (!(dec->json.flags & F_BINARY))
3255 0 0 if (c == (UV)-1)
3269 3 1799 if (hi == (UV)-1)
3271 0 1799 if (dec->json.flags & F_BINARY)
3275 372 1427 if (hi >= 0xd800) {
3276 352 20 if (hi < 0xdc00) {
3277 345 7 if (dec_cur [0] != '\\' || dec_cur [1] != 'u')
3 342 if (dec_cur [0] != '\\' || dec_cur [1] != 'u')
3285 4 338 if (lo == (UV)-1)
3288 332 6 if (lo < 0xdc00 || lo >= 0xe000)
0 332 if (lo < 0xdc00 || lo >= 0xe000)
3292 330 2 if (UNLIKELY(
325 5 if (UNLIKELY(
0 325 if (UNLIKELY(
5 325 if (UNLIKELY(
3299 9 11 else if (UNLIKELY(hi < 0xe000)) {
3323 8 3 if (UNLIKELY(
4 4 if (UNLIKELY(
2 2 if (UNLIKELY(
6 2 if (UNLIKELY(
2 4 if (UNLIKELY(
2 0 if (UNLIKELY(
2 4 if (UNLIKELY(
4 4 if (UNLIKELY(
3330 1093 677 if (hi >= 0x80)
3345 109852 17 else if (LIKELY(ch >= 0x20 && ch < 0x80)) {
108681 1171 else if (LIKELY(ch >= 0x20 && ch < 0x80)) {
3349 1171 17 else if (ch >= 0x80)
3357 60 1111 if (clen == (STRLEN)-1)
3362 1831 1111 while (--clen);
3366 1 16 else if (dec->json.flags & F_RELAXED && ch == '\t') {
1 0 else if (dec->json.flags & F_RELAXED && ch == '\t') {
3372 9 7 if (!ch)
3378 115182 2 while (cur < buf + SHORT_STRING_LEN);
3383 1 4935 if (sv)
3387 1 0 if (SvLEN (sv) <= cur + len)
3388 1 0 SvGROW (sv, cur + (len < (cur >> 2) ? cur >> 2 : len) + 1);
1 0 SvGROW (sv, cur + (len < (cur >> 2) ? cur >> 2 : len) + 1);
3397 1 4935 while (*dec_cur != endstr);
3401 4935 0 if (sv)
3406 435 4500 if (utf8)
3439 57 909 if (*dec->cur == '-')
3442 118 848 if (*dec->cur == '0')
3445 29 89 if (*dec->cur >= '0' && *dec->cur <= '9')
6 23 if (*dec->cur >= '0' && *dec->cur <= '9')
3448 846 2 else if (*dec->cur < '0' || *dec->cur > '9')
5 841 else if (*dec->cur < '0' || *dec->cur > '9')
3455 635 605 while (*dec->cur >= '0' && *dec->cur <= '9');
399 236 while (*dec->cur >= '0' && *dec->cur <= '9');
3458 66 887 if (*dec->cur == '.')
3462 65 1 if (*dec->cur < '0' || *dec->cur > '9')
7 58 if (*dec->cur < '0' || *dec->cur > '9')
3469 231 24 while (*dec->cur >= '0' && *dec->cur <= '9');
197 34 while (*dec->cur >= '0' && *dec->cur <= '9');
3475 892 53 if (*dec->cur == 'e' || *dec->cur == 'E')
8 884 if (*dec->cur == 'e' || *dec->cur == 'E')
3479 50 11 if (*dec->cur == '-' || *dec->cur == '+')
23 27 if (*dec->cur == '-' || *dec->cur == '+')
3482 57 4 if (*dec->cur < '0' || *dec->cur > '9')
13 44 if (*dec->cur < '0' || *dec->cur > '9')
3489 200 21 while (*dec->cur >= '0' && *dec->cur <= '9');
177 23 while (*dec->cur >= '0' && *dec->cur <= '9');
3494 847 81 if (!is_nv)
3498 7 840 if (typesv)
3502 28 819 if (*start == '-')
3524 10 6 if (numtype & IS_NUMBER_IN_UV) {
3525 2 8 if (numtype & IS_NUMBER_NEG)
3527 2 0 if (uv <= (UV)(IV_MAX) + 1)
3538 0 6 if ((sizeof (NV) == sizeof (double) && DBL_DIG >= len)
3546 2 4 if (dec->json.flags & F_ALLOW_BIGNUM) {
3554 2 0 errsv = ERRSV;
3555 0 2 if (SvROK (errsv))
3557 2 0 else if (SvTRUE (errsv))
0 2 else if (SvTRUE (errsv))
0 2 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
2 0 else if (SvTRUE (errsv))
2 0 else if (SvTRUE (errsv))
2 0 else if (SvTRUE (errsv))
0 2 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 2 else if (SvTRUE (errsv))
3571 4 77 if (typesv)
3574 2 79 if (dec->json.flags & F_ALLOW_BIGNUM) {
3582 2 0 errsv = ERRSV;
3583 0 2 if (SvROK (errsv))
3585 2 0 else if (SvTRUE (errsv))
0 2 else if (SvTRUE (errsv))
0 2 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
2 0 else if (SvTRUE (errsv))
2 0 else if (SvTRUE (errsv))
2 0 else if (SvTRUE (errsv))
0 2 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 0 else if (SvTRUE (errsv))
0 2 else if (SvTRUE (errsv))
3609 5 4218 DEC_INC_DEPTH;
3612 5 4213 if (typesv)
3616 5 0 SvSetMagicSV (typesv, typerv);
0 5 SvSetMagicSV (typesv, typerv);
3619 29 4189 if (*dec->cur == ']')
3627 13 6337 if (typesv)
3634 1506 4844 if (!value)
3641 2654 2190 if (*dec->cur == ']')
3647 27 2163 if (*dec->cur != ',')
3654 5 2158 if (*dec->cur == ']' && dec->json.flags & F_RELAXED)
2 3 if (*dec->cur == ']' && dec->json.flags & F_RELAXED)
3682 0 2584 DEC_INC_DEPTH;
3685 2 2582 if (typesv)
3689 2 0 SvSetMagicSV (typesv, typerv);
0 2 SvSetMagicSV (typesv, typerv);
3692 17 2567 if (*dec->cur == '}')
3699 19 5031 if (UNLIKELY(allow_barekey
6 13 if (UNLIKELY(allow_barekey
6 5044 if (UNLIKELY(allow_barekey
6 0 if (UNLIKELY(allow_barekey
3702 16 5028 else if (UNLIKELY(allow_squote)) {
3703 5 11 if (*dec->cur != '"' && *dec->cur != 0x27) {
1 4 if (*dec->cur != '"' && *dec->cur != 0x27) {
3706 4 11 else if (*dec->cur == 0x27)
3711 24 5004 EXPECT_CH ('"');
3729 31145 21 if (!is_bare &&
31143 2 if (!is_bare &&
3730 31139 4 (p == e || *p < 0x20 || *(U8*)p >= 0x80 || *p == '\\'
31139 0 (p == e || *p < 0x20 || *(U8*)p >= 0x80 || *p == '\\'
30936 203 (p == e || *p < 0x20 || *(U8*)p >= 0x80 || *p == '\\'
3731 14 30922 || allow_squote))
3736 4 219 if (!key)
3739 211 8 if (!allow_dupkeys && UNLIKELY(hv_exists_ent (hv, key, 0))) {
1 210 if (!allow_dupkeys && UNLIKELY(hv_exists_ent (hv, key, 0))) {
3742 0 218 decode_ws (dec); EXPECT_CH (':');
3745 0 218 if (typesv)
3752 1 217 if (!value)
3763 26147 4796 else if (*p == endstr
3764 21 26126 || (is_bare &&
17 4 || (is_bare &&
3765 16 1 (*p == ':' || *p == ' ' || *p == 0x0a
16 0 (*p == ':' || *p == ' ' || *p == 0x0a
3766 16 0 || *p == 0x0d || *p == 0x09)))
1 15 || *p == 0x0d || *p == 0x09)))
3775 0 4802 if (UNLIKELY(p - key > I32_MAX))
3778 4795 7 if (!allow_dupkeys && UNLIKELY(hv_exists (hv, key, len))) {
6 4789 if (!allow_dupkeys && UNLIKELY(hv_exists (hv, key, len))) {
3783 4792 4 decode_ws (dec); if (*p != ':') EXPECT_CH (':');
8 4784 decode_ws (dec); if (*p != ':') EXPECT_CH (':');
3786 9 4779 if (typesv)
3793 776 4012 if (!value)
3812 1740 2489 if (*dec->cur == '}')
3818 5 2484 if (*dec->cur != ',')
3825 3 2481 if (*dec->cur == '}' && dec->json.flags & F_RELAXED)
1 2 if (*dec->cur == '}' && dec->json.flags & F_RELAXED)
3836 14 1744 if (dec->json.flags & F_HOOK)
3838 11 3 if (dec->json.cb_sk_object && HvKEYS (hv) == 1)
0 11 if (dec->json.cb_sk_object && HvKEYS (hv) == 1)
7 4 if (dec->json.cb_sk_object && HvKEYS (hv) == 1)
3848 7 0 if (LIKELY((long)he))
3851 6 1 if (cb)
3856 0 6 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
0 6 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
3857 0 6 XPUSHs (HeVAL (he));
3862 4 2 if (count == 1)
3865 4 0 PUTBACK; FREETMPS; LEAVE;
3871 2 0 PUTBACK; FREETMPS; LEAVE;
3875 8 2 if (dec->json.cb_object)
3880 0 8 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
0 8 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
3881 0 8 XPUSHs (sv_2mortal (sv));
3885 3 5 if (count == 1)
3888 3 0 PUTBACK; FREETMPS; LEAVE;
3894 5 0 PUTBACK; FREETMPS; LEAVE;
3912 0 1 if (!(dec->json.flags & F_ALLOW_TAGS))
3920 0 1 if (!tag)
3923 0 1 if (!SvPOK (tag))
3928 0 1 if (*dec->cur != ')')
3936 0 1 if (!val)
3939 1 0 if (!SvROK (val) || SvTYPE (SvRV (val)) != SVt_PVAV)
0 1 if (!SvROK (val) || SvTYPE (SvRV (val)) != SVt_PVAV)
3951 0 1 if (!stash)
3956 0 1 if (!method)
3959 0 1 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
0 1 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
3960 1 0 EXTEND (SP, len + 2);
0 1 EXTEND (SP, len + 2);
3965 3 1 for (i = 0; i < len; ++i)
3978 1 0 FREETMPS; LEAVE;
3998 5 4825 if (typesv)
4002 3 3 if (dec->json.flags & F_ALLOW_SQUOTE) {
4004 0 3 if (typesv)
4020 31 1 if (dec->end - dec->cur >= 4 && memEQc(dec->cur, "true"))
28 3 if (dec->end - dec->cur >= 4 && memEQc(dec->cur, "true"))
4024 5 23 if (typesv)
4026 4 24 if (dec->json.flags & F_UNBLESSED_BOOL)
4036 24 1 if (dec->end - dec->cur >= 5 && memEQc(dec->cur, "false"))
23 1 if (dec->end - dec->cur >= 5 && memEQc(dec->cur, "false"))
4040 5 18 if (typesv)
4042 4 19 if (dec->json.flags & F_UNBLESSED_BOOL)
4052 58 1 if (dec->end - dec->cur >= 4 && memEQc(dec->cur, "null"))
56 2 if (dec->end - dec->cur >= 4 && memEQc(dec->cur, "null"))
4055 3 53 if (typesv)
4097 0 8 PUSHMARK(SP);
4098 0 8 XPUSHs(newSVpvn(encoding, strlen(encoding)));
4099 0 8 XPUSHs(string);
4110 8 0 if (items >= 0 && SvPOK(TOPs)) {
8 0 if (items >= 0 && SvPOK(TOPs)) {
4137 1333 111 if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash(string))
1328 5 if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash(string))
198 1130 if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash(string))
1 197 if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash(string))
4140 4 1440 SvUPGRADE (string, SVt_PV);
4159 1438 6 if (UNLIKELY(len > json->max_size && json->max_size))
1 1437 if (UNLIKELY(len > json->max_size && json->max_size))
4172 1395 48 if (UNLIKELY(len > 2 && SvPOK(string) && !json->incr_pos)) {
1395 0 if (UNLIKELY(len > 2 && SvPOK(string) && !json->incr_pos)) {
1395 48 if (UNLIKELY(len > 2 && SvPOK(string) && !json->incr_pos)) {
1126 269 if (UNLIKELY(len > 2 && SvPOK(string) && !json->incr_pos)) {
4174 12 1114 if (*s >= 0xEF) {
4175 12 0 if (len >= 3 && memEQc(s, UTF8BOM)) {
5 7 if (len >= 3 && memEQc(s, UTF8BOM)) {
4183 7 0 } else if (len >= 4 && memEQc(s, UTF32BOM)) {
2 5 } else if (len >= 4 && memEQc(s, UTF32BOM)) {
4187 2 3 } else if (memEQc(s, UTF16BOM)) {
4191 2 1 } else if (memEQc(s, UTF16BOM_BE)) {
4196 1071 43 } else if (UNLIKELY(len >= 4 && !*s && memEQc(s, UTF32BOM_BE))) {
2 1069 } else if (UNLIKELY(len >= 4 && !*s && memEQc(s, UTF32BOM_BE))) {
2 1112 } else if (UNLIKELY(len >= 4 && !*s && memEQc(s, UTF32BOM_BE))) {
2 0 } else if (UNLIKELY(len >= 4 && !*s && memEQc(s, UTF32BOM_BE))) {
4203 1430 13 if (LIKELY(!converted)) {
4204 752 678 if (DECODE_WANTS_OCTETS (json))
4211 0 1442 if (!SvPOK(string))
4212 0 0 SvGROW (string, SvCUR (string) + 1);
0 0 SvGROW (string, SvCUR (string) + 1);
4220 1432 10 if (dec.json.cb_object || dec.json.cb_sk_object)
4 1428 if (dec.json.cb_object || dec.json.cb_sk_object)
4228 283 1159 if (offset_return) {
4229 283 0 if (dec.cur < SvPVX (string) || dec.cur > SvEND (string))
0 283 if (dec.cur < SvPVX (string) || dec.cur > SvEND (string))
4235 1159 283 if (!(offset_return || !sv))
841 318 if (!(offset_return || !sv))
4240 820 21 if ((dec.end - dec.cur) || *dec.cur)
0 820 if ((dec.end - dec.cur) || *dec.cur)
4248 5 1437 if (UNLIKELY(offset)) {
4253 343 1099 if (!sv)
4268 306 37 croak ("%s, at character offset %d (before \"%s\")",
4271 306 0 dec.cur != dec.end ? SvPV_nolen (uni) : "(end of string)");
4274 885 214 if (!(dec.json.flags & F_ALLOW_NONREF) && json_nonref(aTHX_ sv))
9 876 if (!(dec.json.flags & F_ALLOW_NONREF) && json_nonref(aTHX_ sv))
4277 12 1078 if (UNLIKELY(converted && !(converted - 1))) /* with BOM, and UTF8 was not set */
1 11 if (UNLIKELY(converted && !(converted - 1))) /* with BOM, and UTF8 was not set */
4302 278 278 if (*p > 0x20)
4304 6 272 if (*p == '#')
4315 42 236 else if (!*p)
4323 0 0 if (!*p)
4336 9 36 if (*p == '\n')
4338 6 3 self->incr_mode = self->incr_mode == INCR_M_C0 ? INCR_M_WS : INCR_M_JSON;
4341 0 36 else if (!*p)
4354 583 1502 if (*p == '"')
4359 15 568 if (!self->incr_nest)
4364 498 1004 else if (*p == '\\')
4368 0 498 if (!*p) /* if at end of string we have to switch modes */
4374 2 1002 else if (!*p)
4395 0 682 if (!self->incr_nest)
4409 1 357 if (++self->incr_nest > (int)self->max_depth)
4415 256 99 if (--self->incr_nest <= 0)
4507 0 217 XPUSHs (sv_2mortal (sv_bless (
217 0 XPUSHs (sv_2mortal (sv_bless (
4539 292 14 if (enable)
4543 0 306 XPUSHs (ST (0));
4571 0 0 XPUSHs (boolSV (self->flags & ix));
0 0 XPUSHs (boolSV (self->flags & ix));
4575 1 0 if (0 <= val && val <= 15) {
1 0 if (0 <= val && val <= 15) {
4580 0 1 XPUSHs (ST (0));
4591 0 5 XPUSHs (ST (0));
4602 0 3 XPUSHs (ST (0));
4612 11 0 if (infnan_mode > 3 || infnan_mode < 0) {
0 11 if (infnan_mode > 3 || infnan_mode < 0) {
4616 0 11 XPUSHs (ST (0));
4628 0 3 self->cb_sort_by = SvOK (cb) ? newSVsv (cb) : 0;
0 0 self->cb_sort_by = SvOK (cb) ? newSVsv (cb) : 0;
0 0 self->cb_sort_by = SvOK (cb) ? newSVsv (cb) : 0;
4629 3 0 if (self->cb_sort_by)
4632 0 3 XPUSHs (ST (0));
4640 1 4 self->cb_object = SvOK (cb) ? newSVsv (cb) : 0;
1 0 self->cb_object = SvOK (cb) ? newSVsv (cb) : 0;
0 1 self->cb_object = SvOK (cb) ? newSVsv (cb) : 0;
4642 0 5 XPUSHs (ST (0));
4648 3 3 if (!self->cb_sk_object)
4651 1 5 if (SvOK (cb))
1 0 if (SvOK (cb))
0 1 if (SvOK (cb))
4657 0 1 if (!HvKEYS (self->cb_sk_object))
0 1 if (!HvKEYS (self->cb_sk_object))
4664 0 6 XPUSHs (ST (0));
4670 0 1109 XPUSHs (scalar);
4675 0 648 XPUSHs (jsonstr);
4683 0 10 EXTEND (SP, 2);
4691 27 599 if (!self->incr_text)
4695 27 599 if (!DECODE_WANTS_OCTETS (self) == !SvUTF8 (self->incr_text)) {
4696 0 27 if (DECODE_WANTS_OCTETS (self))
4698 0 0 if (self->incr_pos)
4708 0 27 if (self->incr_pos)
4715 321 305 if (jsonstr)
4718 319 2 if (SvUTF8 (jsonstr) != SvUTF8 (self->incr_text)) {
4719 0 319 if (SvUTF8 (jsonstr))
4728 321 0 const char *str = SvPV (jsonstr, len);
4731 147 174 if (SvLEN (self->incr_text) <= cur + len)
4732 147 0 SvGROW (self->incr_text, cur + (len < (cur >> 2) ? cur >> 2 : len) + 1);
147 0 SvGROW (self->incr_text, cur + (len < (cur >> 2) ? cur >> 2 : len) + 1);
4740 626 0 if (GIMME_V != G_VOID)
317 309 if (GIMME_V != G_VOID)
4747 317 2 if (!INCR_DONE (self))
316 1 if (!INCR_DONE (self))
4751 278 39 if (UNLIKELY(self->incr_pos > self->max_size && self->max_size))
1 277 if (UNLIKELY(self->incr_pos > self->max_size && self->max_size))
4755 314 2 if (!INCR_DONE (self))
44 270 if (!INCR_DONE (self))
4758 42 4 if (self->incr_mode == INCR_M_WS && self->incr_pos)
4 38 if (self->incr_mode == INCR_M_WS && self->incr_pos)
4769 0 267 XPUSHs (sv);
4781 267 0 while (GIMME_V == G_ARRAY);
2 265 while (GIMME_V == G_ARRAY);
4791 0 290 if (UNLIKELY(self->incr_pos))
4798 289 1 ST(0) = self->incr_text ? self->incr_text : &PL_sv_undef;
4819 2 0 if (self->incr_pos)
4821 2 0 sv_chop (self->incr_text, SvPV_nolen (self->incr_text) + self->incr_pos);
4831 1 0 if (self->incr_text)
4860 0 215 XPUSHs (scalar);
4872 216 0 if (ix && allow_nonref)
9 207 if (ix && allow_nonref)
4875 0 165 XPUSHs (jsonstr);