Branch Coverage

XS.xs
Criterion Covered Total %
branch 1179 1792 65.7


line true false branch
382 57 0 if ( !cxt->mojo_boolean_stash )
384 57 0 if ( !cxt->jsonold_boolean_stash )
409 0 114 if (!SvOBJECT(sv) || !SvSTASH(sv)) {
0 0 if (!SvOBJECT(sv) || !SvSTASH(sv)) {
425 200 0 if (SvLEN (sv) > SvCUR (sv) + 1)
443 2791 0 if (LIKELY(len >= 2
1308 1483 if (LIKELY(len >= 2
1308 1483 if (LIKELY(len >= 2
1306 2 if (LIKELY(len >= 2
455 4 1481 UV c = utf8n_to_uvuni (s, len, clen,
521 0 1335 if (UNLIKELY(ch < 0x000080))
523 736 599 else if (LIKELY(ch < 0x000800))
526 267 332 else if (ch < 0x010000)
530 332 0 else if (ch < 0x110000)
545 50 303 : offset;
589 0 130 if (UNLIKELY(--maxdepth <= 0))
590 0 0 while (((U8)*s - '0') < 10)
597 130 340 if (UNLIKELY(dig >= 10))
599 52 78 if (dig == (U8)((U8)'.' - (U8)'0'))
604 44 34 else if ((dig | ' ') == 'e' - '0')
611 10 34 if (*s == '-')
616 16 18 else if (*s == '+')
619 221 44 while ((dig = (U8)*s - '0') < 10)
622 10 34 *expo += neg ? -exp2 : exp2;
635 0 340 if (uaccum >= (UV_MAX - 9) / 10)
637 0 0 if (postdp) *expo -= eaccum;
639 0 0 if (postdp) *expo += eaccum;
649 52 78 if (postdp) *expo -= eaccum;
667 17 61 if (*s == '-')
676 17 61 return neg ? -accum : accum;
686 27 1817 if (svt < SVt_PVAV)
689 24 3 char *pv = svt ? SvPV_nomg (sv, len) : 0;
9 15 char *pv = svt ? SvPV_nomg (sv, len) : 0;
691 9 18 if (len == 1) {
692 5 4 if (*pv == '1')
694 3 1 else if (*pv == '0')
707 7 1831 if (!SvROK (scalar))
712 1817 14 if (!SvOBJECT (scalar) && ref_bool_type (aTHX_ scalar) >= 0)
0 1817 if (!SvOBJECT (scalar) && ref_bool_type (aTHX_ scalar) >= 0)
715 14 1817 if (SvOBJECT (scalar)) {
722 12 2 if (stash == bstash || stash == mstash || stash == oldstash)
12 0 if (stash == bstash || stash == mstash || stash == oldstash)
0 12 if (stash == bstash || stash == mstash || stash == oldstash)
751 3095 57432 if (UNLIKELY(enc->cur + len >= enc->end))
754 3095 0 SvGROW (enc->sv, cur + (len < (cur >> 2) ? cur >> 2 : len) + 1);
1837 1258 SvGROW (enc->sv, cur + (len < (cur >> 2) ? cur >> 2 : len) + 1);
784 47978 2337 while (str < end)
791 46088 1890 if (LIKELY(ch >= 0x20 && ch < 0x80)) /* most common case */
39728 6360 if (LIKELY(ch >= 0x20 && ch < 0x80)) /* most common case */
794 225 39503 if (UNLIKELY(ch == '"')) /* but with slow exceptions */
801 414 39089 else if (UNLIKELY(ch == '\\'))
808 39 39050 else if (UNLIKELY(ch == '/' && (enc->json.flags & F_ESCAPE_SLASH)))
1 38 else if (UNLIKELY(ch == '/' && (enc->json.flags & F_ESCAPE_SLASH)))
843 3637 4053 if (is_utf8 && !(enc->json.flags & F_BINARY))
1620 2017 if (is_utf8 && !(enc->json.flags & F_BINARY))
847 0 1620 if (clen == (STRLEN)-1)
856 6360 1330 if (uch < 0x80/*0x20*/ || uch >= enc->limit)
5195 1165 if (uch < 0x80/*0x20*/ || uch >= enc->limit)
858 5015 1510 if (enc->json.flags & F_BINARY)
868 320 1190 else if (uch >= 0x10000UL)
870 0 320 if (uch >= 0x110000UL)
894 8 1157 else if (enc->json.flags & F_LATIN1)
900 0 1157 else if (enc->json.flags & F_BINARY)
906 915 242 else if (is_utf8)
914 1851 915 while (--clen);
940 32 3688 if (enc->json.flags & F_INDENT)
959 40 3729 if (enc->json.flags & F_INDENT)
970 8 1200 if (enc->json.flags & F_INDENT)
972 0 1200 else if (enc->json.flags & F_SPACE_AFTER)
984 1 895 if (enc->indent >= enc->json.max_depth)
987 0 895 SvGETMAGIC (typesv);
0 0 SvGETMAGIC (typesv);
989 873 22 if (UNLIKELY (SvOK (typesv)))
873 0 if (UNLIKELY (SvOK (typesv)))
0 873 if (UNLIKELY (SvOK (typesv)))
0 873 if (UNLIKELY (SvOK (typesv)))
991 22 0 if (SvROK (typesv) &&
16 6 if (SvROK (typesv) &&
992 11 5 SvOBJECT (SvRV (typesv)) &&
996 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;
997 11 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ANYOF_CLASS)))
11 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ANYOF_CLASS)))
1001 0 11 if (UNLIKELY (!typesv_ref))
1002 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'",
1006 0 11 SvGETMAGIC (typesv);
0 0 SvGETMAGIC (typesv);
1007 0 11 if (!SvOK (typesv))
0 0 if (!SvOK (typesv))
0 0 if (!SvOK (typesv))
1008 0 0 croak ("no array alternative in anyof was specified for '%s'",
1013 0 22 if (UNLIKELY (!SvROK (typesv)))
1014 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1018 9 13 if (!SvOBJECT (SvRV (typesv)) && SvTYPE (SvRV (typesv)) == SVt_PVAV)
9 0 if (!SvOBJECT (SvRV (typesv)) && SvTYPE (SvRV (typesv)) == SVt_PVAV)
1021 0 9 if (len != av_len (typeav))
1022 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'",
1026 13 0 else if (SvOBJECT (SvRV (typesv)) &&
13 0 else if (SvOBJECT (SvRV (typesv)) &&
1030 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;
1031 13 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ARRAYOF_CLASS)))
13 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ARRAYOF_CLASS)))
1034 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1039 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1046 885 10 if (len >= 0)
1050 1730 870 for (i = 0; i <= len; ++i)
1054 23 1707 if (typeav)
1057 23 0 if (typerv)
1063 1728 2 if (svp)
1068 845 870 if (i < len)
1083 1 743 if (He_IS_SVKEY(he))
1086 1 0 SV *sv = HeSVKEY (he);
1 0 SV *sv = HeSVKEY (he);
1087 1 0 *key = SvPV (sv, len);
1098 4 740 if (utf8) *klen = -(*klen);
1108 7 737 if (enc->json.flags & F_SPACE_BEFORE) encode_space (aTHX_ enc);
1110 7 737 if (enc->json.flags & F_SPACE_AFTER ) encode_space (aTHX_ enc);
1125 198 114 if (!(cmp = memcmp (HeKEY (b), HeKEY (a), lb < la ? lb : la)))
1136 353 0 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
0 353 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
10 343 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
353 0 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
0 353 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
17 336 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
1145 1 391 if (enc->indent >= enc->json.max_depth)
1148 0 391 SvGETMAGIC (typesv);
0 0 SvGETMAGIC (typesv);
1150 374 17 if (UNLIKELY (SvOK (typesv)))
374 0 if (UNLIKELY (SvOK (typesv)))
0 374 if (UNLIKELY (SvOK (typesv)))
0 374 if (UNLIKELY (SvOK (typesv)))
1152 17 0 if (SvROK (typesv) &&
6 11 if (SvROK (typesv) &&
1153 4 2 SvOBJECT (SvRV (typesv)) &&
1157 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;
1158 4 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ANYOF_CLASS)))
4 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ANYOF_CLASS)))
1162 0 4 if (UNLIKELY (!typesv_ref))
1163 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'",
1167 0 4 SvGETMAGIC (typesv);
0 0 SvGETMAGIC (typesv);
1168 0 4 if (!SvOK (typesv))
0 0 if (!SvOK (typesv))
0 0 if (!SvOK (typesv))
1169 0 0 croak ("no hash alternative in anyof was specified for '%s'",
1174 0 17 if (UNLIKELY (!SvROK (typesv)))
1175 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1179 13 4 if (!SvOBJECT (SvRV (typesv)) && SvTYPE (SvRV (typesv)) == SVt_PVHV)
13 0 if (!SvOBJECT (SvRV (typesv)) && SvTYPE (SvRV (typesv)) == SVt_PVHV)
1181 4 0 else if (SvOBJECT (SvRV (typesv)) &&
4 0 else if (SvOBJECT (SvRV (typesv)) &&
1185 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;
1186 4 0 if (LIKELY (name && strEQ (name, JSON_TYPE_HASHOF_CLASS)))
4 0 if (LIKELY (name && strEQ (name, JSON_TYPE_HASHOF_CLASS)))
1189 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1194 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1204 239 152 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))
1208 0 239 if (SvMAGICAL (hv))
1216 0 0 while (hv_iternext (hv))
1222 233 6 if (count)
1229 0 233 if (count > STACK_HES)
1236 584 233 while ((he = hv_iternext (hv)))
1239 584 0 if (HeKLEN (he) < 0 || HeKUTF8 (he))
3 581 if (HeKLEN (he) < 0 || HeKUTF8 (he))
1245 230 3 if (fast)
1261 3 0 FREETMPS;
1267 584 232 while (count--)
1277 29 555 if (UNLIKELY (PTR2ul (typehv)))
1280 0 29 if (UNLIKELY (!typesv_ref))
1286 0 584 encode_sv (aTHX_ enc, UNLIKELY(SvMAGICAL (hv)) ? hv_iterval (hv, he) : HeVAL (he), typesv);
1288 351 232 if (count)
1297 5 147 if (hv_iterinit (hv) || SvMAGICAL (hv))
1 4 if (hv_iterinit (hv) || SvMAGICAL (hv))
1298 148 0 if ((he = hv_iternext (hv)))
1311 0 160 if (UNLIKELY (PTR2ul (typehv)))
1314 0 0 if (UNLIKELY (!typesv_ref))
1320 1 159 encode_sv (aTHX_ enc, UNLIKELY(SvMAGICAL (hv)) ? hv_iterval (hv, he) : HeVAL (he), typesv);
1322 144 12 if (!(he = hv_iternext (hv)))
1360 9 2 if (isref && SvAMAGIC(sv))
9 0 if (isref && SvAMAGIC(sv))
9 0 if (isref && SvAMAGIC(sv))
9 0 if (isref && SvAMAGIC(sv))
1363 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)) {
1364 0 2 if (isref && !(enc->json.flags & F_ALLOW_UNKNOWN))
0 0 if (isref && !(enc->json.flags & F_ALLOW_UNKNOWN))
1365 0 0 croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or 1",
1371 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) {
1376 0 9 SvSETMAGIC(pv);
1377 0 9 str = SvPVutf8_force(pv, len);
1398 0 9 if (!len) {
1405 0 0 if (SvGMAGICAL(sv)) mg_get(sv);
1406 0 0 if (MyAMG(sv)) { /* force a RV here */
0 0 if (MyAMG(sv)) { /* force a RV here */
1421 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));
1422 0 0 if (pv && SvPOK(pv)) {
0 0 if (pv && SvPOK(pv)) {
1423 0 0 str = SvPVutf8_force(pv, len);
1433 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] == '+')) {
1438 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(
1446 7 0 if (stash
1450 4 3 if (enc->json.infnan_mode == 0) {
1452 4 0 if (pv) SvREFCNT_dec(pv);
1454 3 0 } else if (enc->json.infnan_mode == 3) {
1455 2 1 if (memEQc(str, "NaN") || memEQc(str, "nan"))
0 2 if (memEQc(str, "NaN") || memEQc(str, "nan"))
1457 1 1 else if (memEQc(str, "inf"))
1461 3 0 if (pv) SvREFCNT_dec(pv);
1466 0 2 if (!str)
1469 0 2 if (isref != 1)
1472 0 2 if (isref != 1)
1488 28 35 if (stash == bstash || stash == mstash || stash == oldstash)
28 0 if (stash == bstash || stash == mstash || stash == oldstash)
0 28 if (stash == bstash || stash == mstash || stash == oldstash)
1490 3 32 if (as_string)
1492 35 0 if (SvIV_nomg (sv))
20 15 if (SvIV_nomg (sv))
1496 3 32 if (as_string)
1499 0 28 else if (force_conversion && enc->json.flags & F_CONV_BLESSED)
0 0 else if (force_conversion && enc->json.flags & F_CONV_BLESSED)
1501 0 0 if (as_string)
1503 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))
1507 0 0 if (as_string)
1521 5 22 if (bool_type == 1)
1523 3 19 else if (bool_type == 0)
1543 51 29 if (UNLIKELY (SvOBJECT (sv)))
1545 28 23 if (!encode_bool_obj (aTHX_ enc, sv, 0, 0))
1548 7 21 if ((enc->json.flags & F_ALLOW_TAGS)
1549 6 1 && (method = gv_fetchmethod_autoload (stash, "FREEZE", 0)))
1555 0 6 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
0 6 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
1556 0 6 EXTEND (SP, 2);
1566 2 4 if (SvROK (TOPs) && SvRV (TOPs) == sv)
0 2 if (SvROK (TOPs) && SvRV (TOPs) == sv)
1567 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",
1568 0 0 HvNAME (SvSTASH (sv)));
0 0 HvNAME (SvSTASH (sv)));
0 0 HvNAME (SvSTASH (sv)));
0 0 HvNAME (SvSTASH (sv)));
1572 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));
1577 255 6 while (count)
1582 249 6 if (count)
1591 6 0 FREETMPS; LEAVE;
1593 18 4 else if ((enc->json.flags & F_CONV_BLESSED)
1594 7 11 && (method = gv_fetchmethod_autoload (stash, "TO_JSON", 0)))
1598 0 7 ENTER; SAVETMPS; PUSHMARK (SP);
1600 0 7 XPUSHs (rv);
1608 3 4 if (SvROK (TOPs) && SvRV (TOPs) == sv)
1 2 if (SvROK (TOPs) && SvRV (TOPs) == sv)
1609 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)));
1616 6 0 FREETMPS; LEAVE;
1618 9 6 else if ((enc->json.flags & F_ALLOW_BIGNUM)
1619 9 0 && stash
1620 1 8 && ((stash == gv_stashpvn ("Math::BigInt", sizeof("Math::BigInt")-1, 0))
1621 1 0 || (stash == gv_stashpvn ("Math::BigFloat", sizeof("Math::BigFloat")-1, 0))))
1623 2 4 else if (enc->json.flags & F_CONV_BLESSED)
1625 2 2 else if (enc->json.flags & F_ALLOW_BLESSED)
1628 0 2 croak ("encountered object '%s', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing)",
1632 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)
1634 19 5 if (!encode_bool_ref (aTHX_ enc, sv))
1636 0 19 if (enc->json.flags & F_ALLOW_STRINGIFY)
1638 7 12 else if (enc->json.flags & F_ALLOW_UNKNOWN)
1641 0 12 croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or 1",
1645 2 3 else if (enc->json.flags & F_ALLOW_UNKNOWN)
1648 0 3 croak ("encountered %s, but JSON can only represent references to arrays or hashes",
1657 95 12 if (!SvROK (sv))
1659 8 87 if (UNLIKELY (sv == &PL_sv_yes))
1661 6 81 else if (UNLIKELY (sv == &PL_sv_no))
1663 1 80 else if (!SvOK (sv))
1 0 else if (!SvOK (sv))
1 0 else if (!SvOK (sv))
1665 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))
1675 9 3 if (UNLIKELY (SvOBJECT (sv)))
1677 0 9 if (!encode_bool_obj (aTHX_ enc, sv, 1, 0))
1678 0 0 croak ("encountered object '%s', but convert_blessed is not enabled",
1681 3 0 else if (svt < SVt_PVAV && svt != SVt_PVGV)
3 0 else if (svt < SVt_PVAV && svt != SVt_PVGV)
1683 0 3 if (!encode_bool_ref (aTHX_ enc, sv))
1684 0 0 croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or 1",
1688 0 0 croak ("encountered %s, but does not represent boolean",
1696 0 31 *iv = SvIV_nomg (sv);
1700 9 22 if (!*is_neg)
1702 0 9 *uv = SvUV_nomg (sv);
1715 3 4007 SvGETMAGIC (sv);
0 3 SvGETMAGIC (sv);
1717 3649 361 if (UNLIKELY (!(SvOK (typesv)) && (enc->json.flags & F_REQUIRE_TYPES)))
3649 0 if (UNLIKELY (!(SvOK (typesv)) && (enc->json.flags & F_REQUIRE_TYPES)))
3649 0 if (UNLIKELY (!(SvOK (typesv)) && (enc->json.flags & F_REQUIRE_TYPES)))
3649 0 if (UNLIKELY (!(SvOK (typesv)) && (enc->json.flags & F_REQUIRE_TYPES)))
3649 361 if (UNLIKELY (!(SvOK (typesv)) && (enc->json.flags & F_REQUIRE_TYPES)))
8 3641 if (UNLIKELY (!(SvOK (typesv)) && (enc->json.flags & F_REQUIRE_TYPES)))
1718 0 8 croak ("type for '%s' was not specified", SvPV_nolen (sv));
1720 1390 2612 if (SvROK (sv) && !SvOBJECT (SvRV (sv)))
1320 70 if (SvROK (sv) && !SvOBJECT (SvRV (sv)))
1723 392 928 if (svt == SVt_PVHV)
1728 896 32 else if (svt == SVt_PVAV)
1735 0 2714 SvGETMAGIC (typesv);
0 0 SvGETMAGIC (typesv);
1737 2392 322 if (UNLIKELY (SvOK (typesv)))
2392 0 if (UNLIKELY (SvOK (typesv)))
0 2392 if (UNLIKELY (SvOK (typesv)))
0 2392 if (UNLIKELY (SvOK (typesv)))
1739 83 239 if (!SvIOKp (typesv))
1741 83 0 if (SvROK (typesv) &&
83 0 if (SvROK (typesv) &&
1742 83 0 SvOBJECT (SvRV (typesv)) &&
1746 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;
1747 83 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ANYOF_CLASS)))
83 0 if (LIKELY (name && strEQ (name, JSON_TYPE_ANYOF_CLASS)))
1751 0 83 if (UNLIKELY (!typesv_ref))
1752 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'",
1756 0 83 SvGETMAGIC (typesv);
0 0 SvGETMAGIC (typesv);
1757 0 83 if (!SvIOKp (typesv))
1758 0 0 croak ("no scalar alternative in anyof was specified for '%s'", SvPV_nolen (sv));
1761 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1766 0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
0 0 croak ("encountered type (%s, 0x%x) was specified for '%s'",
1773 320 2394 if (UNLIKELY (type))
1781 2390 4 if (UNLIKELY (sv == &PL_sv_yes || sv == &PL_sv_no)) type = JSON_TYPE_BOOL;
4 2386 if (UNLIKELY (sv == &PL_sv_yes || sv == &PL_sv_no)) type = JSON_TYPE_BOOL;
1782 78 2308 else if (SvNOKp (sv)) type = JSON_TYPE_FLOAT;
1783 872 1436 else if (SvIOKp (sv)) type = JSON_TYPE_INT;
1784 1314 122 else if (SvPOKp (sv)) type = JSON_TYPE_STRING;
1785 80 42 else if (SvROK (sv)) process_ref = 1;
1786 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;
1789 150 2564 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))
1791 107 2552 else if (type == JSON_TYPE_BOOL)
1793 117 2435 else if (type == JSON_TYPE_FLOAT)
1805 106 11 NV nv = SvNOKp (sv) ? SvNVX (sv) : SvNV_nomg (sv);
0 11 NV nv = SvNOKp (sv) ? SvNVX (sv) : SvNV_nomg (sv);
1870 4 113 if (UNLIKELY(strEQc(enc->cur, STR_INF)))
1891 4 109 (UNLIKELY(strEQc(enc->cur, STR_NAN)))
1894 20 89 else if (*enc->cur == '-') {
1904 4 16 if (UNLIKELY(strEQc(enc->cur+1, STR_INF)))
1919 8 8 (UNLIKELY(strEQc(enc->cur+1, STR_NAN)))
1923 20 97 if (UNLIKELY(inf_or_nan)) {
1927 5 15 if (enc->json.infnan_mode == 0) {
1930 5 10 else if (enc->json.infnan_mode == 1) {
1937 5 5 else if (enc->json.infnan_mode == 3) {
1938 1 4 if (inf_or_nan == 1)
1940 1 3 else if (inf_or_nan == 2)
1942 3 0 else if (inf_or_nan == 3)
1945 0 5 else if (enc->json.infnan_mode != 2) {
1950 78 39 if (!force_conversion && SvPOKp (sv) && !strEQ(enc->cur, SvPVX (sv))) {
4 74 if (!force_conversion && SvPOKp (sv) && !strEQ(enc->cur, SvPVX (sv))) {
3 1 if (!force_conversion && SvPOKp (sv) && !strEQ(enc->cur, SvPVX (sv))) {
1962 94 20 if (!( inf_or_nan || (SvNOKp(sv) && Perl_modf(SvNVX(sv), &intpart)) || (!force_conversion && SvIOK(sv))
90 4 if (!( inf_or_nan || (SvNOKp(sv) && Perl_modf(SvNVX(sv), &intpart)) || (!force_conversion && SvIOK(sv))
64 26 if (!( inf_or_nan || (SvNOKp(sv) && Perl_modf(SvNVX(sv), &intpart)) || (!force_conversion && SvIOK(sv))
30 38 if (!( inf_or_nan || (SvNOKp(sv) && Perl_modf(SvNVX(sv), &intpart)) || (!force_conversion && SvIOK(sv))
25 5 if (!( inf_or_nan || (SvNOKp(sv) && Perl_modf(SvNVX(sv), &intpart)) || (!force_conversion && SvIOK(sv))
56 0 if (!( inf_or_nan || (SvNOKp(sv) && Perl_modf(SvNVX(sv), &intpart)) || (!force_conversion && SvIOK(sv))
1963 56 7 || strchr(enc->cur,'e') || strchr(enc->cur,'E')
1977 986 1449 else if (type == JSON_TYPE_INT)
1986 915 71 if (SvIOKp (sv))
1992 44 27 else if (SvPOKp (sv))
1995 37 7 if (numtype & IS_NUMBER_IN_UV)
1997 5 32 if (numtype & IS_NUMBER_NEG)
2000 3 2 if (LIKELY(uv <= (UV)(IV_MAX) + 1))
2009 2 5 else if (UNLIKELY (numtype & IS_NUMBER_INFINITY))
2012 1 1 if (is_neg)
2023 4 1 else if (LIKELY (!(numtype & IS_NUMBER_NAN)))
2058 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
2072 10 947 *enc->cur = '-'; enc->cur += i < 0 ? 1 : 0;
2083 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;
2084 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;
2085 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;
2086 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;
2099 16 13 : snprintf (enc->cur, IVUV_MAXCHARS, "%" IVdf, iv);
2102 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))) {
2113 1369 80 else if (type == JSON_TYPE_STRING)
2115 0 1369 if (UNLIKELY (sv == &PL_sv_yes))
2121 0 1369 else if (UNLIKELY (sv == &PL_sv_no))
2127 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))
2131 1351 15 if (SvPOKp (sv))
2138 0 15 str = SvPV_nomg (sv, len);
2145 80 0 else if (process_ref)
2147 0 0 else if (enc->json.flags & F_ALLOW_UNKNOWN)
2150 0 0 croak ("encountered perl type (%s,0x%x) that JSON cannot handle, check your input data",
2159 955 322 if (!(json->flags & F_ALLOW_NONREF) && json_nonref (aTHX_ scalar))
0 955 if (!(json->flags & F_ALLOW_NONREF) && json_nonref (aTHX_ scalar))
2168 1165 112 : enc.json.flags & F_BINARY ? 0x000080UL
2169 962 203 : enc.json.flags & F_LATIN1 ? 0x000100UL
2170 5 957 : 0x110000UL;
2179 600 649 if (!(enc.json.flags & (F_ASCII | F_LATIN1 | F_BINARY | F_UTF8)))
2182 200 1049 if (enc.json.flags & F_SHRINK)
2207 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)
2218 26940 36953 if (ch > 0x20)
2220 11 26929 if (UNLIKELY(ch == '#'))
2222 9 2 if (dec->json.flags & F_RELAXED)
2230 5480 31473 else if (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)
861 4619 else if (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)
861 0 else if (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)
859 2 else if (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)
2780 3 2141 d1 = decode_hexdigit [cur [0]]; if (UNLIKELY(d1 < 0)) ERR ("exactly four hexadecimal digits expected");
2781 2 2139 d2 = decode_hexdigit [cur [1]]; if (UNLIKELY(d2 < 0)) ERR ("exactly four hexadecimal digits expected");
2782 1 2138 d3 = decode_hexdigit [cur [2]]; if (UNLIKELY(d3 < 0)) ERR ("exactly four hexadecimal digits expected");
2783 1 2137 d4 = decode_hexdigit [cur [3]]; if (UNLIKELY(d4 < 0)) ERR ("exactly four hexadecimal digits expected");
2802 0 2506 d1 = decode_hexdigit [cur [0]]; if (UNLIKELY(d1 < 0)) ERR ("exactly two hexadecimal digits expected");
2803 0 2506 d2 = decode_hexdigit [cur [1]]; if (UNLIKELY(d2 < 0)) ERR ("exactly two hexadecimal digits expected");
2817 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");
2818 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");
2819 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");
2844 3793 113766 if (UNLIKELY(ch == endstr))
2846 7 3786 if (ch == 0x27 && !(dec->json.flags & F_ALLOW_SQUOTE)) {
0 7 if (ch == 0x27 && !(dec->json.flags & F_ALLOW_SQUOTE)) {
2852 5436 108330 else if (UNLIKELY(ch == '\\'))
2869 2 2506 if (!(dec->json.flags & F_BINARY))
2874 0 2506 if (c == (UV)-1)
2884 1 0 if (!(dec->json.flags & F_BINARY))
2888 0 0 if (c == (UV)-1)
2902 3 1799 if (hi == (UV)-1)
2904 0 1799 if (dec->json.flags & F_BINARY)
2908 372 1427 if (hi >= 0xd800) {
2909 352 20 if (hi < 0xdc00) {
2910 345 7 if (dec_cur [0] != '\\' || dec_cur [1] != 'u')
3 342 if (dec_cur [0] != '\\' || dec_cur [1] != 'u')
2918 4 338 if (lo == (UV)-1)
2921 332 6 if (lo < 0xdc00 || lo >= 0xe000)
0 332 if (lo < 0xdc00 || lo >= 0xe000)
2925 330 2 if (UNLIKELY(
325 5 if (UNLIKELY(
0 325 if (UNLIKELY(
5 325 if (UNLIKELY(
2932 9 11 else if (UNLIKELY(hi < 0xe000)) {
2956 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(
2963 1093 677 if (hi >= 0x80)
2978 108313 17 else if (LIKELY(ch >= 0x20 && ch < 0x80)) {
107142 1171 else if (LIKELY(ch >= 0x20 && ch < 0x80)) {
2982 1171 17 else if (ch >= 0x80)
2990 60 1111 if (clen == (STRLEN)-1)
2995 1831 1111 while (--clen);
2999 1 16 else if (dec->json.flags & F_RELAXED && ch == '\t') {
1 0 else if (dec->json.flags & F_RELAXED && ch == '\t') {
3005 9 7 if (!ch)
3011 113643 2 while (cur < buf + SHORT_STRING_LEN);
3016 1 3794 if (sv)
3020 1 0 if (SvLEN (sv) <= cur + len)
3021 1 0 SvGROW (sv, cur + (len < (cur >> 2) ? cur >> 2 : len) + 1);
1 0 SvGROW (sv, cur + (len < (cur >> 2) ? cur >> 2 : len) + 1);
3030 1 3794 while (*dec_cur != endstr);
3034 3794 0 if (sv)
3039 435 3359 if (utf8)
3072 57 907 if (*dec->cur == '-')
3075 117 847 if (*dec->cur == '0')
3078 29 88 if (*dec->cur >= '0' && *dec->cur <= '9')
6 23 if (*dec->cur >= '0' && *dec->cur <= '9')
3081 845 2 else if (*dec->cur < '0' || *dec->cur > '9')
5 840 else if (*dec->cur < '0' || *dec->cur > '9')
3088 634 605 while (*dec->cur >= '0' && *dec->cur <= '9');
399 235 while (*dec->cur >= '0' && *dec->cur <= '9');
3091 65 886 if (*dec->cur == '.')
3095 64 1 if (*dec->cur < '0' || *dec->cur > '9')
7 57 if (*dec->cur < '0' || *dec->cur > '9')
3102 230 24 while (*dec->cur >= '0' && *dec->cur <= '9');
197 33 while (*dec->cur >= '0' && *dec->cur <= '9');
3108 890 53 if (*dec->cur == 'e' || *dec->cur == 'E')
8 882 if (*dec->cur == 'e' || *dec->cur == 'E')
3112 50 11 if (*dec->cur == '-' || *dec->cur == '+')
23 27 if (*dec->cur == '-' || *dec->cur == '+')
3115 57 4 if (*dec->cur < '0' || *dec->cur > '9')
13 44 if (*dec->cur < '0' || *dec->cur > '9')
3122 200 21 while (*dec->cur >= '0' && *dec->cur <= '9');
177 23 while (*dec->cur >= '0' && *dec->cur <= '9');
3127 846 80 if (!is_nv)
3131 7 839 if (typesv)
3135 28 818 if (*start == '-')
3157 10 6 if (numtype & IS_NUMBER_IN_UV) {
3158 2 8 if (numtype & IS_NUMBER_NEG)
3160 2 0 if (uv <= (UV)(IV_MAX) + 1)
3171 0 6 if ((sizeof (NV) == sizeof (double) && DBL_DIG >= len)
3179 2 4 if (dec->json.flags & F_ALLOW_BIGNUM) {
3187 2 0 errsv = ERRSV;
3188 0 2 if (SvROK (errsv))
3190 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))
3204 4 76 if (typesv)
3207 2 78 if (dec->json.flags & F_ALLOW_BIGNUM) {
3215 2 0 errsv = ERRSV;
3216 0 2 if (SvROK (errsv))
3218 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))
3242 5 4216 DEC_INC_DEPTH;
3245 5 4211 if (typesv)
3249 5 0 SvSetMagicSV (typesv, typerv);
0 5 SvSetMagicSV (typesv, typerv);
3252 29 4187 if (*dec->cur == ']')
3260 13 6334 if (typesv)
3267 1506 4841 if (!value)
3274 2652 2189 if (*dec->cur == ']')
3280 27 2162 if (*dec->cur != ',')
3287 5 2157 if (*dec->cur == ']' && dec->json.flags & F_RELAXED)
2 3 if (*dec->cur == ']' && dec->json.flags & F_RELAXED)
3315 0 2468 DEC_INC_DEPTH;
3318 2 2466 if (typesv)
3322 2 0 SvSetMagicSV (typesv, typerv);
0 2 SvSetMagicSV (typesv, typerv);
3325 17 2451 if (*dec->cur == '}')
3332 19 3775 if (UNLIKELY(allow_barekey
6 13 if (UNLIKELY(allow_barekey
6 3788 if (UNLIKELY(allow_barekey
6 0 if (UNLIKELY(allow_barekey
3335 16 3772 else if (UNLIKELY(allow_squote)) {
3336 5 11 if (*dec->cur != '"' && *dec->cur != 0x27) {
1 4 if (*dec->cur != '"' && *dec->cur != 0x27) {
3339 4 11 else if (*dec->cur == 0x27)
3344 24 3748 EXPECT_CH ('"');
3362 21324 21 if (!is_bare &&
21322 2 if (!is_bare &&
3363 21318 4 (p == e || *p < 0x20 || *(U8*)p >= 0x80 || *p == '\\'
21318 0 (p == e || *p < 0x20 || *(U8*)p >= 0x80 || *p == '\\'
21115 203 (p == e || *p < 0x20 || *(U8*)p >= 0x80 || *p == '\\'
3364 14 21101 || allow_squote))
3369 4 219 if (!key)
3372 211 8 if (!allow_dupkeys && UNLIKELY(hv_exists_ent (hv, key, 0))) {
1 210 if (!allow_dupkeys && UNLIKELY(hv_exists_ent (hv, key, 0))) {
3375 0 218 decode_ws (dec); EXPECT_CH (':');
3378 0 218 if (typesv)
3385 1 217 if (!value)
3396 17582 3540 else if (*p == endstr
3397 21 17561 || (is_bare &&
17 4 || (is_bare &&
3398 16 1 (*p == ':' || *p == ' ' || *p == 0x0a
16 0 (*p == ':' || *p == ' ' || *p == 0x0a
3399 16 0 || *p == 0x0d || *p == 0x09)))
1 15 || *p == 0x0d || *p == 0x09)))
3408 0 3546 if (UNLIKELY(p - key > I32_MAX))
3411 3541 5 if (!allow_dupkeys && UNLIKELY(hv_exists (hv, key, len))) {
6 3535 if (!allow_dupkeys && UNLIKELY(hv_exists (hv, key, len))) {
3416 3536 4 decode_ws (dec); if (*p != ':') EXPECT_CH (':');
8 3528 decode_ws (dec); if (*p != ':') EXPECT_CH (':');
3419 9 3523 if (typesv)
3426 776 2756 if (!value)
3445 1624 1349 if (*dec->cur == '}')
3451 5 1344 if (*dec->cur != ',')
3458 3 1341 if (*dec->cur == '}' && dec->json.flags & F_RELAXED)
1 2 if (*dec->cur == '}' && dec->json.flags & F_RELAXED)
3469 14 1628 if (dec->json.flags & F_HOOK)
3471 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)
3481 7 0 if (LIKELY((long)he))
3484 6 1 if (cb)
3489 0 6 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
0 6 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
3490 0 6 XPUSHs (HeVAL (he));
3495 4 2 if (count == 1)
3498 4 0 PUTBACK; FREETMPS; LEAVE;
3504 2 0 PUTBACK; FREETMPS; LEAVE;
3508 8 2 if (dec->json.cb_object)
3513 0 8 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
0 8 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
3514 0 8 XPUSHs (sv_2mortal (sv));
3518 3 5 if (count == 1)
3521 3 0 PUTBACK; FREETMPS; LEAVE;
3527 5 0 PUTBACK; FREETMPS; LEAVE;
3545 0 1 if (!(dec->json.flags & F_ALLOW_TAGS))
3553 0 1 if (!tag)
3556 0 1 if (!SvPOK (tag))
3561 0 1 if (*dec->cur != ')')
3569 0 1 if (!val)
3572 1 0 if (!SvROK (val) || SvTYPE (SvRV (val)) != SVt_PVAV)
0 1 if (!SvROK (val) || SvTYPE (SvRV (val)) != SVt_PVAV)
3584 0 1 if (!stash)
3589 0 1 if (!method)
3592 0 1 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
0 1 ENTER; SAVETMPS; SAVESTACK_POS (); PUSHMARK (SP);
3593 1 0 EXTEND (SP, len + 2);
0 1 EXTEND (SP, len + 2);
3598 3 1 for (i = 0; i < len; ++i)
3611 1 0 FREETMPS; LEAVE;
3631 5 3684 if (typesv)
3635 3 3 if (dec->json.flags & F_ALLOW_SQUOTE) {
3637 0 3 if (typesv)
3653 30 1 if (dec->end - dec->cur >= 4 && memEQc(dec->cur, "true"))
27 3 if (dec->end - dec->cur >= 4 && memEQc(dec->cur, "true"))
3657 5 22 if (typesv)
3659 4 23 if (dec->json.flags & F_UNBLESSED_BOOL)
3669 23 1 if (dec->end - dec->cur >= 5 && memEQc(dec->cur, "false"))
22 1 if (dec->end - dec->cur >= 5 && memEQc(dec->cur, "false"))
3673 5 17 if (typesv)
3675 4 18 if (dec->json.flags & F_UNBLESSED_BOOL)
3685 58 1 if (dec->end - dec->cur >= 4 && memEQc(dec->cur, "null"))
56 2 if (dec->end - dec->cur >= 4 && memEQc(dec->cur, "null"))
3688 3 53 if (typesv)
3730 0 8 PUSHMARK(SP);
3731 0 8 XPUSHs(newSVpvn(encoding, strlen(encoding)));
3732 0 8 XPUSHs(string);
3743 8 0 if (items >= 0 && SvPOK(TOPs)) {
8 0 if (items >= 0 && SvPOK(TOPs)) {
3770 1329 111 if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash(string))
1324 5 if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash(string))
195 1129 if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash(string))
1 194 if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash(string))
3773 4 1436 SvUPGRADE (string, SVt_PV);
3792 1434 6 if (UNLIKELY(len > json->max_size && json->max_size))
1 1433 if (UNLIKELY(len > json->max_size && json->max_size))
3805 1391 48 if (UNLIKELY(len > 2 && SvPOK(string) && !json->incr_pos)) {
1391 0 if (UNLIKELY(len > 2 && SvPOK(string) && !json->incr_pos)) {
1391 48 if (UNLIKELY(len > 2 && SvPOK(string) && !json->incr_pos)) {
1122 269 if (UNLIKELY(len > 2 && SvPOK(string) && !json->incr_pos)) {
3807 12 1110 if (*s >= 0xEF) {
3808 12 0 if (len >= 3 && memEQc(s, UTF8BOM)) {
5 7 if (len >= 3 && memEQc(s, UTF8BOM)) {
3816 7 0 } else if (len >= 4 && memEQc(s, UTF32BOM)) {
2 5 } else if (len >= 4 && memEQc(s, UTF32BOM)) {
3820 2 3 } else if (memEQc(s, UTF16BOM)) {
3824 2 1 } else if (memEQc(s, UTF16BOM_BE)) {
3829 1067 43 } else if (UNLIKELY(len >= 4 && !*s && memEQc(s, UTF32BOM_BE))) {
2 1065 } else if (UNLIKELY(len >= 4 && !*s && memEQc(s, UTF32BOM_BE))) {
2 1108 } else if (UNLIKELY(len >= 4 && !*s && memEQc(s, UTF32BOM_BE))) {
2 0 } else if (UNLIKELY(len >= 4 && !*s && memEQc(s, UTF32BOM_BE))) {
3836 1426 13 if (LIKELY(!converted)) {
3837 750 676 if (DECODE_WANTS_OCTETS (json))
3844 0 1438 if (!SvPOK(string))
3845 0 0 SvGROW (string, SvCUR (string) + 1);
0 0 SvGROW (string, SvCUR (string) + 1);
3853 1428 10 if (dec.json.cb_object || dec.json.cb_sk_object)
4 1424 if (dec.json.cb_object || dec.json.cb_sk_object)
3861 283 1155 if (offset_return) {
3862 283 0 if (dec.cur < SvPVX (string) || dec.cur > SvEND (string))
0 283 if (dec.cur < SvPVX (string) || dec.cur > SvEND (string))
3868 1155 283 if (!(offset_return || !sv))
837 318 if (!(offset_return || !sv))
3873 816 21 if ((dec.end - dec.cur) || *dec.cur)
0 816 if ((dec.end - dec.cur) || *dec.cur)
3881 5 1433 if (UNLIKELY(offset)) {
3886 343 1095 if (!sv)
3901 306 37 croak ("%s, at character offset %d (before \"%s\")",
3904 306 0 dec.cur != dec.end ? SvPV_nolen (uni) : "(end of string)");
3907 883 212 if (!(dec.json.flags & F_ALLOW_NONREF) && json_nonref(aTHX_ sv))
9 874 if (!(dec.json.flags & F_ALLOW_NONREF) && json_nonref(aTHX_ sv))
3910 12 1074 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 */
3935 278 278 if (*p > 0x20)
3937 6 272 if (*p == '#')
3948 42 236 else if (!*p)
3956 0 0 if (!*p)
3969 9 36 if (*p == '\n')
3971 6 3 self->incr_mode = self->incr_mode == INCR_M_C0 ? INCR_M_WS : INCR_M_JSON;
3974 0 36 else if (!*p)
3987 583 1502 if (*p == '"')
3992 15 568 if (!self->incr_nest)
3997 498 1004 else if (*p == '\\')
4001 0 498 if (!*p) /* if at end of string we have to switch modes */
4007 2 1002 else if (!*p)
4028 0 682 if (!self->incr_nest)
4042 1 357 if (++self->incr_nest > (int)self->max_depth)
4048 256 99 if (--self->incr_nest <= 0)
4140 0 213 XPUSHs (sv_2mortal (sv_bless (
213 0 XPUSHs (sv_2mortal (sv_bless (
4172 273 14 if (enable)
4176 0 287 XPUSHs (ST (0));
4204 0 0 XPUSHs (boolSV (self->flags & ix));
0 0 XPUSHs (boolSV (self->flags & ix));
4208 1 0 if (0 <= val && val <= 15) {
1 0 if (0 <= val && val <= 15) {
4213 0 1 XPUSHs (ST (0));
4224 0 5 XPUSHs (ST (0));
4235 0 3 XPUSHs (ST (0));
4245 9 0 if (infnan_mode > 3 || infnan_mode < 0) {
0 9 if (infnan_mode > 3 || infnan_mode < 0) {
4249 0 9 XPUSHs (ST (0));
4261 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;
4262 3 0 if (self->cb_sort_by)
4265 0 3 XPUSHs (ST (0));
4273 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;
4275 0 5 XPUSHs (ST (0));
4281 3 3 if (!self->cb_sk_object)
4284 1 5 if (SvOK (cb))
1 0 if (SvOK (cb))
0 1 if (SvOK (cb))
4290 0 1 if (!HvKEYS (self->cb_sk_object))
0 1 if (!HvKEYS (self->cb_sk_object))
4297 0 6 XPUSHs (ST (0));
4303 0 1034 XPUSHs (scalar);
4308 0 644 XPUSHs (jsonstr);
4316 0 10 EXTEND (SP, 2);
4324 27 599 if (!self->incr_text)
4328 27 599 if (!DECODE_WANTS_OCTETS (self) == !SvUTF8 (self->incr_text)) {
4329 0 27 if (DECODE_WANTS_OCTETS (self))
4331 0 0 if (self->incr_pos)
4341 0 27 if (self->incr_pos)
4348 321 305 if (jsonstr)
4351 319 2 if (SvUTF8 (jsonstr) != SvUTF8 (self->incr_text)) {
4352 0 319 if (SvUTF8 (jsonstr))
4361 321 0 const char *str = SvPV (jsonstr, len);
4364 147 174 if (SvLEN (self->incr_text) <= cur + len)
4365 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);
4373 626 0 if (GIMME_V != G_VOID)
317 309 if (GIMME_V != G_VOID)
4380 317 2 if (!INCR_DONE (self))
316 1 if (!INCR_DONE (self))
4384 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))
4388 314 2 if (!INCR_DONE (self))
44 270 if (!INCR_DONE (self))
4391 42 4 if (self->incr_mode == INCR_M_WS && self->incr_pos)
4 38 if (self->incr_mode == INCR_M_WS && self->incr_pos)
4402 0 267 XPUSHs (sv);
4414 267 0 while (GIMME_V == G_ARRAY);
2 265 while (GIMME_V == G_ARRAY);
4424 0 290 if (UNLIKELY(self->incr_pos))
4431 289 1 ST(0) = self->incr_text ? self->incr_text : &PL_sv_undef;
4452 2 0 if (self->incr_pos)
4454 2 0 sv_chop (self->incr_text, SvPV_nolen (self->incr_text) + self->incr_pos);
4464 1 0 if (self->incr_text)
4493 0 215 XPUSHs (scalar);
4505 216 0 if (ix && allow_nonref)
9 207 if (ix && allow_nonref)
4508 0 165 XPUSHs (jsonstr);