Branch Coverage

XS.xs
Criterion Covered Total %
branch 622 852 73.0


line true false branch
156 9211 5 if (SvLEN (sv) > SvCUR (sv) + 1)
172 0 180142 if (sum < (size_t)l2 || sum != (size_t)(STRLEN)sum)
185 6460 83611 if (len1 > 4096 - 24)
188 90071 0 return SvGROW (sv, len1);
65002 25069 return SvGROW (sv, len1);
199 8161143 9 if (expect_true (len >= 2
1418766 6742377 if (expect_true (len >= 2
1418766 0 if (expect_true (len >= 2
1418766 6742386 if (expect_true (len >= 2
216 0 4522979 if (expect_false (ch < 0x000080))
218 2277494 2245485 else if (expect_true (ch < 0x000800))
221 1117751 1127734 else if ( ch < 0x010000)
225 1127734 0 else if ( ch < 0x110000)
238 34 39 return SvUTF8 (sv)
255 0 114 if (expect_false (--maxdepth <= 0))
256 0 0 while (((U8)*s - '0') < 10)
263 114 215 if (expect_false (dig >= 10))
265 46 68 if (dig == (U8)((U8)'.' - (U8)'0'))
270 53 15 else if ((dig | ' ') == 'e' - '0')
277 6 47 if (*s == '-')
282 29 18 else if (*s == '+')
285 85 53 while ((dig = (U8)*s - '0') < 10)
288 6 47 *expo += neg ? -exp2 : exp2;
301 0 215 if (uaccum >= (UV_MAX - 9) / 10)
303 0 0 if (postdp) *expo -= eaccum;
305 0 0 if (postdp) *expo += eaccum;
315 46 68 if (postdp) *expo -= eaccum;
327 16 52 if (*s == '-')
336 16 52 return neg ? -accum : accum;
345 9 15756 if (svt < SVt_PVAV)
348 8 1 char *pv = svt ? SvPV (sv, len) : 0;
1 7 char *pv = svt ? SvPV (sv, len) : 0;
350 3 6 if (len == 1)
351 1 2 if (*pv == '1')
353 1 1 else if (*pv == '0')
364 1 15756 if (!SvROK (scalar))
369 15756 0 if (SvTYPE (scalar) >= SVt_PVMG)
371 0 15756 if (SvSTASH (scalar) == bool_stash)
374 15756 0 if (!SvOBJECT (scalar) && ref_bool_type (scalar) >= 0)
0 15756 if (!SvOBJECT (scalar) && ref_bool_type (scalar) >= 0)
398 89916 7655682 if (expect_false ((uintptr_t)(enc->end - enc->cur) < len))
421 9478837 26037 while (str < end)
425 8785304 693533 if (expect_true (ch >= 0x20 && ch < 0x80)) // most common case
1904995 6880309 if (expect_true (ch >= 0x20 && ch < 0x80)) // most common case
1904995 7573842 if (expect_true (ch >= 0x20 && ch < 0x80)) // most common case
427 21118 1883877 if (expect_false (ch == '"')) // but with slow exceptions
433 19396 1864481 else if (expect_false (ch == '\\'))
459 4721101 2739868 if (is_utf8)
462 0 4721101 if (clen == (STRLEN)-1)
471 6880309 580660 if (uch < 0x80/*0x20*/ || uch >= enc->limit)
3440024 3440285 if (uch < 0x80/*0x20*/ || uch >= enc->limit)
473 1127734 2892950 if (uch >= 0x10000UL)
475 0 1127734 if (uch >= 0x110000UL)
497 2 3440283 else if (enc->json.flags & F_LATIN1)
502 2357539 1082744 else if (is_utf8)
509 5730803 2357539 while (--clen);
528 23 51686 if (enc->json.flags & F_INDENT)
548 30 75675 if (enc->json.flags & F_INDENT)
560 5 1095 if (enc->json.flags & F_INDENT)
562 0 1095 else if (enc->json.flags & F_SPACE_AFTER)
573 1 24993 if (enc->indent >= enc->json.max_depth)
578 24983 10 if (len >= 0)
582 25776 24974 for (i = 0; i <= len; ++i)
588 25774 2 if (svp)
593 793 24974 if (i < len)
608 1 633 if (HeKLEN (he) == HEf_SVKEY)
610 1 0 SV *sv = HeSVKEY (he);
1 0 SV *sv = HeSVKEY (he);
614 0 1 SvGETMAGIC (sv);
0 0 SvGETMAGIC (sv);
615 1 0 str = SvPV (sv, len);
624 5 629 if (enc->json.flags & F_SPACE_BEFORE) encode_space (enc);
626 5 629 if (enc->json.flags & F_SPACE_AFTER ) encode_space (enc);
641 198 24 if (!(cmp = memcmp (HeKEY (b), HeKEY (a), lb < la ? lb : la)))
651 364 0 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
0 364 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
9 355 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
364 0 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
0 364 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
14 350 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
659 1 337 if (enc->indent >= enc->json.max_depth)
668 219 118 if (enc->json.flags & F_CANONICAL && !SvRMAGICAL (hv))
219 0 if (enc->json.flags & F_CANONICAL && !SvRMAGICAL (hv))
672 0 219 if (SvMAGICAL (hv))
680 0 0 while (hv_iternext (hv))
686 213 6 if (count)
693 0 213 if (count > STACK_HES)
700 517 213 while ((he = hv_iternext (hv)))
703 517 0 if (HeKLEN (he) < 0 || HeKUTF8 (he))
3 514 if (HeKLEN (he) < 0 || HeKUTF8 (he))
709 210 3 if (fast)
725 3 0 FREETMPS;
731 517 213 while (count--)
736 0 517 encode_sv (enc, expect_false (SvMAGICAL (hv)) ? hv_iterval (hv, he) : HeVAL (he));
738 304 213 if (count)
747 5 113 if (hv_iterinit (hv) || SvMAGICAL (hv))
1 4 if (hv_iterinit (hv) || SvMAGICAL (hv))
748 114 0 if ((he = hv_iternext (hv)))
756 1 116 encode_sv (enc, expect_false (SvMAGICAL (hv)) ? hv_iterval (hv, he) : HeVAL (he));
758 112 3 if (!(he = hv_iternext (hv)))
778 0 25366 SvGETMAGIC (sv);
0 0 SvGETMAGIC (sv);
781 24 25342 if (expect_false (SvOBJECT (sv)))
785 16 8 if (stash == bool_stash)
787 16 0 if (SvIV (sv)) encode_str (enc, "true" , 4, 0);
8 8 if (SvIV (sv)) encode_str (enc, "true" , 4, 0);
790 2 6 else if ((enc->json.flags & F_ALLOW_TAGS) && (method = gv_fetchmethod_autoload (stash, "FREEZE", 0)))
1 1 else if ((enc->json.flags & F_ALLOW_TAGS) && (method = gv_fetchmethod_autoload (stash, "FREEZE", 0)))
796 0 1 PUSHMARK (SP);
797 0 1 EXTEND (SP, 2);
807 0 1 if (SvROK (TOPs) && SvRV (TOPs) == sv)
0 0 if (SvROK (TOPs) && SvRV (TOPs) == sv)
808 0 0 croak ("%s::FREEZE method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv)));
0 0 croak ("%s::FREEZE method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv)));
0 0 croak ("%s::FREEZE method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv)));
0 0 croak ("%s::FREEZE method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv)));
0 0 croak ("%s::FREEZE method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv)));
0 0 croak ("%s::FREEZE method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv)));
812 1 0 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
1 0 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 1 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 0 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
1 0 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 1 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 1 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
1 0 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
1 0 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 1 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 0 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
1 0 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 1 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
1 0 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
1 0 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 1 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 0 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
1 0 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
0 1 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
817 1 0 if (count)
821 2 1 for (i = 0; i < count - 1; ++i)
833 1 0 FREETMPS; LEAVE;
835 3 4 else if ((enc->json.flags & F_CONV_BLESSED) && (method = gv_fetchmethod_autoload (stash, "TO_JSON", 0)))
2 1 else if ((enc->json.flags & F_CONV_BLESSED) && (method = gv_fetchmethod_autoload (stash, "TO_JSON", 0)))
840 0 2 PUSHMARK (SP);
842 0 2 XPUSHs (sv_bless (sv_2mortal (newRV_inc (sv)), stash));
850 1 1 if (SvROK (TOPs) && SvRV (TOPs) == sv)
0 1 if (SvROK (TOPs) && SvRV (TOPs) == sv)
851 0 0 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)));
0 0 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)));
0 0 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)));
858 2 0 FREETMPS; LEAVE;
860 3 2 else if (enc->json.flags & F_ALLOW_BLESSED)
863 0 2 croak ("encountered object '%s', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing)",
866 338 25004 else if (svt == SVt_PVHV)
868 24994 10 else if (svt == SVt_PVAV)
870 9 1 else if (svt < SVt_PVAV)
874 1 8 if (bool_type == 1)
876 1 7 else if (bool_type == 0)
878 0 7 else if (enc->json.flags & F_ALLOW_UNKNOWN)
881 0 7 croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or 1",
884 0 1 else if (enc->json.flags & F_ALLOW_UNKNOWN)
887 0 1 croak ("encountered %s, but JSON can only represent references to arrays or hashes",
894 3 51513 SvGETMAGIC (sv);
0 3 SvGETMAGIC (sv);
896 25337 26179 if (SvPOKp (sv))
899 25337 0 char *str = SvPV (sv, len);
904 76 26103 else if (SvNOKp (sv))
911 695 25408 else if (SvIOKp (sv))
916 0 695 if (SvIsUV (sv) ? SvUVX (sv) <= 59000
692 3 if (SvIsUV (sv) ? SvUVX (sv) <= 59000
917 692 3 : SvIVX (sv) <= 59000 && SvIVX (sv) >= -59000)
692 0 : SvIVX (sv) <= 59000 && SvIVX (sv) >= -59000)
928 3 689 *enc->cur = '-'; enc->cur += i < 0 ? 1 : 0;
939 692 0 digit = u >> 28; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0xfffffffUL) * 5;
6 686 digit = u >> 28; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0xfffffffUL) * 5;
940 686 6 digit = u >> 27; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0x7ffffffUL) * 5;
3 683 digit = u >> 27; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0x7ffffffUL) * 5;
941 683 9 digit = u >> 26; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0x3ffffffUL) * 5;
0 683 digit = u >> 26; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0x3ffffffUL) * 5;
942 683 9 digit = u >> 25; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0x1ffffffUL) * 5;
5 678 digit = u >> 25; *enc->cur = digit + '0'; enc->cur += (nz = nz || digit); u = (u & 0x1ffffffUL) * 5;
952 0 3 : snprintf (enc->cur, IVUV_MAXCHARS, "%"IVdf, (IV)SvIVX (sv));
955 25366 42 else if (SvROK (sv))
957 42 0 else if (!SvOK (sv) || enc->json.flags & F_ALLOW_UNKNOWN)
42 0 else if (!SvOK (sv) || enc->json.flags & F_ALLOW_UNKNOWN)
0 42 else if (!SvOK (sv) || enc->json.flags & F_ALLOW_UNKNOWN)
0 0 else if (!SvOK (sv) || enc->json.flags & F_ALLOW_UNKNOWN)
960 0 0 croak ("encountered perl type (%s,0x%x) that JSON cannot handle, check your input data",
969 15558 9545 if (!(json->flags & F_ALLOW_NONREF) && json_nonref (scalar))
0 15558 if (!(json->flags & F_ALLOW_NONREF) && json_nonref (scalar))
978 12812 12291 : enc.json.flags & F_LATIN1 ? 0x000100UL
979 2 12810 : 0x110000UL;
988 6460 18631 if (!(enc.json.flags & (F_ASCII | F_LATIN1 | F_UTF8)))
991 9216 15875 if (enc.json.flags & F_SHRINK)
1016 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)
1027 87102 35862 if (ch > 0x20)
1029 9 87093 if (expect_false (ch == '#'))
1031 9 0 if (dec->json.flags & F_RELAXED)
1039 26036 9826 else if (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)
24872 1164 else if (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)
24872 0 else if (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)
24871 1 else if (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)
1067 0 5148634 d1 = decode_hexdigit [cur [0]]; if (expect_false (d1 < 0)) ERR ("exactly four hexadecimal digits expected");
1068 0 5148634 d2 = decode_hexdigit [cur [1]]; if (expect_false (d2 < 0)) ERR ("exactly four hexadecimal digits expected");
1069 0 5148634 d3 = decode_hexdigit [cur [2]]; if (expect_false (d3 < 0)) ERR ("exactly four hexadecimal digits expected");
1070 0 5148634 d4 = decode_hexdigit [cur [3]]; if (expect_false (d4 < 0)) ERR ("exactly four hexadecimal digits expected");
1099 25930 9482294 if (expect_false (ch == '"'))
1104 4174274 5308020 else if (expect_false (ch == '\\'))
1126 0 4020899 if (hi == (UV)-1)
1130 1136912 2883987 if (hi >= 0xd800)
1131 1127736 9176 if (hi < 0xdc00)
1133 1127735 1 if (dec_cur [0] != '\\' || dec_cur [1] != 'u')
0 1127735 if (dec_cur [0] != '\\' || dec_cur [1] != 'u')
1141 0 1127735 if (lo == (UV)-1)
1144 1127734 1 if (lo < 0xdc00 || lo >= 0xe000)
0 1127734 if (lo < 0xdc00 || lo >= 0xe000)
1149 1 9175 else if (hi < 0xe000)
1152 3440235 580661 if (hi >= 0x80)
1168 5308015 5 else if (expect_true (ch >= 0x20 && ch < 0x80))
1867964 3440051 else if (expect_true (ch >= 0x20 && ch < 0x80))
1867964 3440056 else if (expect_true (ch >= 0x20 && ch < 0x80))
1170 3440051 5 else if (ch >= 0x80)
1177 3 3440048 if (clen == (STRLEN)-1)
1182 6813079 3440048 while (--clen);
1186 1 4 else if (ch == '\t' && dec->json.flags & F_RELAXED)
0 1 else if (ch == '\t' && dec->json.flags & F_RELAXED)
1192 1 4 if (!ch)
1198 9482279 0 while (cur < buf + SHORT_STRING_LEN);
1203 0 25930 if (sv)
1207 0 0 if (SvLEN (sv) - cur <= len)
1217 0 25930 while (*dec_cur != '"');
1221 25930 0 if (sv)
1226 23764 2166 if (utf8)
1247 32 771 if (*dec->cur == '-')
1250 68 735 if (*dec->cur == '0')
1253 10 58 if (*dec->cur >= '0' && *dec->cur <= '9')
3 7 if (*dec->cur >= '0' && *dec->cur <= '9')
1256 735 0 else if (*dec->cur < '0' || *dec->cur > '9')
1 734 else if (*dec->cur < '0' || *dec->cur > '9')
1263 326 554 while (*dec->cur >= '0' && *dec->cur <= '9');
146 180 while (*dec->cur >= '0' && *dec->cur <= '9');
1266 47 752 if (*dec->cur == '.')
1270 46 1 if (*dec->cur < '0' || *dec->cur > '9')
0 46 if (*dec->cur < '0' || *dec->cur > '9')
1277 112 12 while (*dec->cur >= '0' && *dec->cur <= '9');
78 34 while (*dec->cur >= '0' && *dec->cur <= '9');
1283 766 32 if (*dec->cur == 'e' || *dec->cur == 'E')
25 741 if (*dec->cur == 'e' || *dec->cur == 'E')
1287 51 6 if (*dec->cur == '-' || *dec->cur == '+')
31 20 if (*dec->cur == '-' || *dec->cur == '+')
1290 55 2 if (*dec->cur < '0' || *dec->cur > '9')
2 53 if (*dec->cur < '0' || *dec->cur > '9')
1297 35 50 while (*dec->cur >= '0' && *dec->cur <= '9');
32 3 while (*dec->cur >= '0' && *dec->cur <= '9');
1302 726 68 if (!is_nv)
1307 13 713 if (*start == '-')
1329 10 0 if (numtype & IS_NUMBER_IN_UV)
1330 2 8 if (numtype & IS_NUMBER_NEG)
1332 2 0 if (uv < (UV)IV_MIN)
1342 0 0 if (len <= NV_DIG)
1362 3 26177 DEC_INC_DEPTH;
1365 23 26154 if (*dec->cur == ']')
1373 563 26370 if (!value)
1380 25585 785 if (*dec->cur == ']')
1386 4 781 if (*dec->cur != ',')
1393 3 778 if (*dec->cur == ']' && dec->json.flags & F_RELAXED)
2 1 if (*dec->cur == ']' && dec->json.flags & F_RELAXED)
1415 0 1604 DEC_INC_DEPTH;
1418 8 1596 if (*dec->cur == '}')
1423 4 2265 EXPECT_CH ('"');
1438 9788 2 if (p == e || *p < 0x20 || *p >= 0x80 || *p == '\\')
9788 0 if (p == e || *p < 0x20 || *p >= 0x80 || *p == '\\')
200 9588 if (p == e || *p < 0x20 || *p >= 0x80 || *p == '\\')
1442 0 202 if (!key)
1445 0 202 decode_ws (dec); EXPECT_CH (':');
1449 1 201 if (!value)
1460 2063 7525 else if (*p == '"')
1467 3 2060 decode_ws (dec); EXPECT_CH (':');
1471 515 1545 if (!value)
1485 1069 677 if (*dec->cur == '}')
1491 3 674 if (*dec->cur != ',')
1498 2 672 if (*dec->cur == '}' && dec->json.flags & F_RELAXED)
1 1 if (*dec->cur == '}' && dec->json.flags & F_RELAXED)
1509 9 1069 if (expect_false (dec->json.flags & F_HOOK))
1511 9 0 if (dec->json.cb_sk_object && HvKEYS (hv) == 1)
0 9 if (dec->json.cb_sk_object && HvKEYS (hv) == 1)
5 4 if (dec->json.cb_sk_object && HvKEYS (hv) == 1)
1523 4 1 if (cb)
1529 0 4 PUSHMARK (SP);
1530 0 4 XPUSHs (HeVAL (he));
1535 3 1 if (count == 1)
1538 3 0 FREETMPS; LEAVE;
1541 0 1 else if (count)
1545 1 0 FREETMPS; LEAVE;
1549 5 1 if (dec->json.cb_object)
1555 0 5 PUSHMARK (SP);
1556 0 5 XPUSHs (sv_2mortal (sv));
1560 2 3 if (count == 1)
1562 3 0 else if (count == 0)
1567 5 0 FREETMPS; LEAVE;
1585 0 1 if (!(dec->json.flags & F_ALLOW_TAGS))
1593 0 1 if (!tag)
1596 0 1 if (!SvPOK (tag))
1601 0 1 if (*dec->cur != ')')
1609 0 1 if (!val)
1612 1 0 if (!SvROK (val) || SvTYPE (SvRV (val)) != SVt_PVAV)
0 1 if (!SvROK (val) || SvTYPE (SvRV (val)) != SVt_PVAV)
1621 0 1 if (!stash)
1626 0 1 if (!method)
1632 0 1 PUSHMARK (SP);
1633 1 0 EXTEND (SP, len + 2);
0 1 EXTEND (SP, len + 2);
1638 3 1 for (i = 0; i < len; ++i)
1651 1 0 FREETMPS; LEAVE;
1680 6 0 if (dec->end - dec->cur >= 5 && !memcmp (dec->cur, "false", 5))
6 0 if (dec->end - dec->cur >= 5 && !memcmp (dec->cur, "false", 5))
1684 4 2 if (expect_false (!dec->json.v_false))
1695 10 0 if (dec->end - dec->cur >= 4 && !memcmp (dec->cur, "true", 4))
9 1 if (dec->end - dec->cur >= 4 && !memcmp (dec->cur, "true", 4))
1699 7 2 if (expect_false (!dec->json.v_true))
1710 43 0 if (dec->end - dec->cur >= 4 && !memcmp (dec->cur, "null", 4))
42 1 if (dec->end - dec->cur >= 4 && !memcmp (dec->cur, "null", 4))
1744 25092 122 if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash (string))
25087 5 if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash (string))
89 24998 if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash (string))
0 89 if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash (string))
1747 4 25210 SvUPGRADE (string, SVt_PV);
1766 25209 5 if (offset > json->max_size && json->max_size)
1 25208 if (offset > json->max_size && json->max_size)
1771 12411 12802 if (DECODE_WANTS_OCTETS (json))
1776 25195 18 SvGROW (string, SvCUR (string) + 1); // should basically be a NOP
0 25195 SvGROW (string, SvCUR (string) + 1); // should basically be a NOP
1784 25205 8 if (dec.json.cb_object || dec.json.cb_sk_object)
2 25203 if (dec.json.cb_object || dec.json.cb_sk_object)
1792 284 24929 if (offset_return)
1794 24869 60 else if (sv)
1799 8 24861 if (dec.cur != dec.end)
1807 71 25142 if (!sv)
1820 62 9 croak ("%s, at character offset %d (before \"%s\")",
1823 62 0 dec.cur != dec.end ? SvPV_nolen (uni) : "(end of string)");
1828 199 24943 if (!(dec.json.flags & F_ALLOW_NONREF) && json_nonref (sv))
1 198 if (!(dec.json.flags & F_ALLOW_NONREF) && json_nonref (sv))
1853 978 29 if (self->incr_nest) // end of a scalar inside array, object or tag
1862 289 298 if (*p > 0x20)
1864 6 283 if (*p == '#')
1875 41 257 else if (!*p)
1883 0 0 if (!*p)
1896 9 36 if (*p == '\n')
1898 6 3 self->incr_mode = self->incr_mode == INCR_M_C0 ? INCR_M_WS : INCR_M_JSON;
1901 0 36 else if (!*p)
1913 105 35 switch (*p++)
1929 93 391 switch (*p++)
1948 581 1492 if (*p == '"')
1953 496 996 else if (*p == '\\')
1957 0 496 if (!*p) // if at end of string we have to switch modes
1963 0 996 else if (!*p)
1984 0 682 if (!self->incr_nest)
2013 1 354 if (++self->incr_nest > self->max_depth)
2019 253 99 if (--self->incr_nest <= 0)
2053 6400 25 for (i = 0; i < 256; ++i)
2054 5200 1200 decode_hexdigit [i] =
3975 2175 decode_hexdigit [i] =
4625 1375 decode_hexdigit [i] =
2055 250 4950 i >= '0' && i <= '9' ? i - '0'
2056 150 3825 : i >= 'a' && i <= 'f' ? i - 'a' + 10
2057 150 4475 : i >= 'A' && i <= 'F' ? i - 'A' + 10
2089 0 43129 XPUSHs (sv_2mortal (sv_bless (
0 43129 XPUSHs (sv_2mortal (sv_bless (
2099 0 0 XPUSHs (ST (0));
2103 0 0 if (self->v_false && self->v_true)
0 0 if (self->v_false && self->v_true)
2105 0 0 EXTEND (SP, 2);
2129 61577 15366 if (enable)
2134 0 76943 XPUSHs (ST (0));
2154 0 0 XPUSHs (boolSV (self->flags & ix));
0 0 XPUSHs (boolSV (self->flags & ix));
2159 0 5 XPUSHs (ST (0));
2170 0 3 XPUSHs (ST (0));
2182 1 2 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;
2184 0 3 XPUSHs (ST (0));
2190 1 3 if (!self->cb_sk_object)
2193 1 3 if (SvOK (cb))
1 0 if (SvOK (cb))
0 1 if (SvOK (cb))
2199 0 1 if (!HvKEYS (self->cb_sk_object))
0 1 if (!HvKEYS (self->cb_sk_object))
2206 0 4 XPUSHs (ST (0));
2211 0 24920 PUTBACK; XPUSHs (encode_json (scalar, self));
2215 0 18728 PUTBACK; XPUSHs (decode_json (jsonstr, self, 0));
2223 0 2 EXTEND (SP, 2);
2225 2 0 PUSHs (sv_2mortal (newSVuv (ptr_to_index (jsonstr, SvPV_nolen (jsonstr) + offset))));
2231 25 641 if (!self->incr_text)
2235 25 641 if (!DECODE_WANTS_OCTETS (self) == !SvUTF8 (self->incr_text))
2236 0 25 if (DECODE_WANTS_OCTETS (self))
2238 0 0 if (self->incr_pos)
2248 0 25 if (self->incr_pos)
2254 347 319 if (jsonstr)
2257 346 1 if (SvUTF8 (jsonstr) != SvUTF8 (self->incr_text))
2258 0 346 if (SvUTF8 (jsonstr))
2266 347 0 const char *str = SvPV (jsonstr, len);
2269 155 192 if (SvLEN (self->incr_text) - cur <= len)
2278 666 0 if (GIMME_V != G_VOID)
326 340 if (GIMME_V != G_VOID)
2284 325 2 if (!INCR_DONE (self))
324 1 if (!INCR_DONE (self))
2288 287 38 if (self->incr_pos > self->max_size && self->max_size)
1 286 if (self->incr_pos > self->max_size && self->max_size)
2292 322 2 if (!INCR_DONE (self))
41 281 if (!INCR_DONE (self))
2295 41 2 if (self->incr_mode == INCR_M_WS && self->incr_pos)
4 37 if (self->incr_mode == INCR_M_WS && self->incr_pos)
2306 0 279 XPUSHs (sv);
2314 279 0 while (GIMME_V == G_ARRAY);
1 278 while (GIMME_V == G_ARRAY);
2321 0 304 if (self->incr_pos)
2324 304 0 RETVAL = self->incr_text ? SvREFCNT_inc (self->incr_text) : &PL_sv_undef;
2332 2 0 if (self->incr_pos)
2334 2 0 sv_chop (self->incr_text, SvPV_nolen (self->incr_text) + self->incr_pos);
2367 0 183 PUTBACK; XPUSHs (encode_json (scalar, &json));
2376 0 6202 PUTBACK; XPUSHs (decode_json (jsonstr, &json, 0));