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 355 0 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
0 355 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
3 352 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
355 0 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
0 355 return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
5 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)
835 1 0 FREETMPS; LEAVE;
837 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)))
842 0 2 PUSHMARK (SP);
844 0 2 XPUSHs (sv_bless (sv_2mortal (newRV_inc (sv)), stash));
852 1 1 if (SvROK (TOPs) && SvRV (TOPs) == sv)
0 1 if (SvROK (TOPs) && SvRV (TOPs) == sv)
853 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)));
860 2 0 FREETMPS; LEAVE;
862 3 2 else if (enc->json.flags & F_ALLOW_BLESSED)
865 0 2 croak ("encountered object '%s', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing)",
868 338 25004 else if (svt == SVt_PVHV)
870 24994 10 else if (svt == SVt_PVAV)
872 9 1 else if (svt < SVt_PVAV)
876 1 8 if (bool_type == 1)
878 1 7 else if (bool_type == 0)
880 0 7 else if (enc->json.flags & F_ALLOW_UNKNOWN)
883 0 7 croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or 1",
886 0 1 else if (enc->json.flags & F_ALLOW_UNKNOWN)
889 0 1 croak ("encountered %s, but JSON can only represent references to arrays or hashes",
896 3 51513 SvGETMAGIC (sv);
0 3 SvGETMAGIC (sv);
898 25337 26179 if (SvPOKp (sv))
901 25337 0 char *str = SvPV (sv, len);
906 76 26103 else if (SvNOKp (sv))
913 695 25408 else if (SvIOKp (sv))
918 0 695 if (SvIsUV (sv) ? SvUVX (sv) <= 59000
692 3 if (SvIsUV (sv) ? SvUVX (sv) <= 59000
919 692 3 : SvIVX (sv) <= 59000 && SvIVX (sv) >= -59000)
692 0 : SvIVX (sv) <= 59000 && SvIVX (sv) >= -59000)
930 3 689 *enc->cur = '-'; enc->cur += i < 0 ? 1 : 0;
941 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;
942 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;
943 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;
944 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;
954 0 3 : snprintf (enc->cur, IVUV_MAXCHARS, "%"IVdf, (IV)SvIVX (sv));
957 25366 42 else if (SvROK (sv))
959 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)
962 0 0 croak ("encountered perl type (%s,0x%x) that JSON cannot handle, check your input data",
971 15558 9545 if (!(json->flags & F_ALLOW_NONREF) && json_nonref (scalar))
0 15558 if (!(json->flags & F_ALLOW_NONREF) && json_nonref (scalar))
980 12812 12291 : enc.json.flags & F_LATIN1 ? 0x000100UL
981 2 12810 : 0x110000UL;
990 6460 18631 if (!(enc.json.flags & (F_ASCII | F_LATIN1 | F_UTF8)))
993 9216 15875 if (enc.json.flags & F_SHRINK)
1018 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)
1029 87102 35862 if (ch > 0x20)
1031 9 87093 if (expect_false (ch == '#'))
1033 9 0 if (dec->json.flags & F_RELAXED)
1041 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)
1069 0 5148634 d1 = decode_hexdigit [cur [0]]; if (expect_false (d1 < 0)) ERR ("exactly four hexadecimal digits expected");
1070 0 5148634 d2 = decode_hexdigit [cur [1]]; if (expect_false (d2 < 0)) ERR ("exactly four hexadecimal digits expected");
1071 0 5148634 d3 = decode_hexdigit [cur [2]]; if (expect_false (d3 < 0)) ERR ("exactly four hexadecimal digits expected");
1072 0 5148634 d4 = decode_hexdigit [cur [3]]; if (expect_false (d4 < 0)) ERR ("exactly four hexadecimal digits expected");
1101 25930 9482294 if (expect_false (ch == '"'))
1106 4174274 5308020 else if (expect_false (ch == '\\'))
1128 0 4020899 if (hi == (UV)-1)
1132 1136912 2883987 if (hi >= 0xd800)
1133 1127736 9176 if (hi < 0xdc00)
1135 1127735 1 if (dec_cur [0] != '\\' || dec_cur [1] != 'u')
0 1127735 if (dec_cur [0] != '\\' || dec_cur [1] != 'u')
1143 0 1127735 if (lo == (UV)-1)
1146 1127734 1 if (lo < 0xdc00 || lo >= 0xe000)
0 1127734 if (lo < 0xdc00 || lo >= 0xe000)
1151 1 9175 else if (hi < 0xe000)
1154 3440235 580661 if (hi >= 0x80)
1170 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))
1172 3440051 5 else if (ch >= 0x80)
1179 3 3440048 if (clen == (STRLEN)-1)
1184 6813079 3440048 while (--clen);
1188 1 4 else if (ch == '\t' && dec->json.flags & F_RELAXED)
0 1 else if (ch == '\t' && dec->json.flags & F_RELAXED)
1194 1 4 if (!ch)
1200 9482279 0 while (cur < buf + SHORT_STRING_LEN);
1205 0 25930 if (sv)
1209 0 0 if (SvLEN (sv) - cur <= len)
1219 0 25930 while (*dec_cur != '"');
1223 25930 0 if (sv)
1228 23764 2166 if (utf8)
1249 32 771 if (*dec->cur == '-')
1252 68 735 if (*dec->cur == '0')
1255 10 58 if (*dec->cur >= '0' && *dec->cur <= '9')
3 7 if (*dec->cur >= '0' && *dec->cur <= '9')
1258 735 0 else if (*dec->cur < '0' || *dec->cur > '9')
1 734 else if (*dec->cur < '0' || *dec->cur > '9')
1265 326 554 while (*dec->cur >= '0' && *dec->cur <= '9');
146 180 while (*dec->cur >= '0' && *dec->cur <= '9');
1268 47 752 if (*dec->cur == '.')
1272 46 1 if (*dec->cur < '0' || *dec->cur > '9')
0 46 if (*dec->cur < '0' || *dec->cur > '9')
1279 112 12 while (*dec->cur >= '0' && *dec->cur <= '9');
78 34 while (*dec->cur >= '0' && *dec->cur <= '9');
1285 766 32 if (*dec->cur == 'e' || *dec->cur == 'E')
25 741 if (*dec->cur == 'e' || *dec->cur == 'E')
1289 51 6 if (*dec->cur == '-' || *dec->cur == '+')
31 20 if (*dec->cur == '-' || *dec->cur == '+')
1292 55 2 if (*dec->cur < '0' || *dec->cur > '9')
2 53 if (*dec->cur < '0' || *dec->cur > '9')
1299 35 50 while (*dec->cur >= '0' && *dec->cur <= '9');
32 3 while (*dec->cur >= '0' && *dec->cur <= '9');
1304 726 68 if (!is_nv)
1309 13 713 if (*start == '-')
1331 10 0 if (numtype & IS_NUMBER_IN_UV)
1332 2 8 if (numtype & IS_NUMBER_NEG)
1334 2 0 if (uv < (UV)IV_MIN)
1344 0 0 if (len <= NV_DIG)
1364 3 26177 DEC_INC_DEPTH;
1367 23 26154 if (*dec->cur == ']')
1375 563 26370 if (!value)
1382 25585 785 if (*dec->cur == ']')
1388 4 781 if (*dec->cur != ',')
1395 3 778 if (*dec->cur == ']' && dec->json.flags & F_RELAXED)
2 1 if (*dec->cur == ']' && dec->json.flags & F_RELAXED)
1417 0 1604 DEC_INC_DEPTH;
1420 8 1596 if (*dec->cur == '}')
1425 4 2265 EXPECT_CH ('"');
1440 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 == '\\')
1444 0 202 if (!key)
1447 0 202 decode_ws (dec); EXPECT_CH (':');
1451 1 201 if (!value)
1462 2063 7525 else if (*p == '"')
1469 3 2060 decode_ws (dec); EXPECT_CH (':');
1473 515 1545 if (!value)
1487 1069 677 if (*dec->cur == '}')
1493 3 674 if (*dec->cur != ',')
1500 2 672 if (*dec->cur == '}' && dec->json.flags & F_RELAXED)
1 1 if (*dec->cur == '}' && dec->json.flags & F_RELAXED)
1511 9 1069 if (expect_false (dec->json.flags & F_HOOK))
1513 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)
1525 4 1 if (cb)
1531 0 4 PUSHMARK (SP);
1532 0 4 XPUSHs (HeVAL (he));
1537 3 1 if (count == 1)
1541 3 0 FREETMPS; LEAVE;
1544 0 1 else if (count)
1551 1 0 FREETMPS; LEAVE;
1555 5 1 if (dec->json.cb_object)
1561 0 5 PUSHMARK (SP);
1562 0 5 XPUSHs (sv_2mortal (sv));
1566 2 3 if (count == 1)
1568 3 0 else if (count == 0)
1575 5 0 FREETMPS; LEAVE;
1593 0 1 if (!(dec->json.flags & F_ALLOW_TAGS))
1601 0 1 if (!tag)
1604 0 1 if (!SvPOK (tag))
1609 0 1 if (*dec->cur != ')')
1617 0 1 if (!val)
1620 1 0 if (!SvROK (val) || SvTYPE (SvRV (val)) != SVt_PVAV)
0 1 if (!SvROK (val) || SvTYPE (SvRV (val)) != SVt_PVAV)
1629 0 1 if (!stash)
1634 0 1 if (!method)
1640 0 1 PUSHMARK (SP);
1641 1 0 EXTEND (SP, len + 2);
0 1 EXTEND (SP, len + 2);
1646 3 1 for (i = 0; i < len; ++i)
1659 1 0 FREETMPS; LEAVE;
1688 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))
1692 4 2 if (expect_false (!dec->json.v_false))
1703 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))
1707 7 2 if (expect_false (!dec->json.v_true))
1718 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))
1752 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))
1755 4 25210 SvUPGRADE (string, SVt_PV);
1774 25209 5 if (offset > json->max_size && json->max_size)
1 25208 if (offset > json->max_size && json->max_size)
1779 12411 12802 if (DECODE_WANTS_OCTETS (json))
1784 25195 18 SvGROW (string, SvCUR (string) + 1); // should basically be a NOP
0 25195 SvGROW (string, SvCUR (string) + 1); // should basically be a NOP
1792 25205 8 if (dec.json.cb_object || dec.json.cb_sk_object)
2 25203 if (dec.json.cb_object || dec.json.cb_sk_object)
1800 284 24929 if (offset_return)
1802 24869 60 else if (sv)
1807 8 24861 if (dec.cur != dec.end)
1815 71 25142 if (!sv)
1828 62 9 croak ("%s, at character offset %d (before \"%s\")",
1831 62 0 dec.cur != dec.end ? SvPV_nolen (uni) : "(end of string)");
1836 199 24943 if (!(dec.json.flags & F_ALLOW_NONREF) && json_nonref (sv))
1 198 if (!(dec.json.flags & F_ALLOW_NONREF) && json_nonref (sv))
1861 978 29 if (self->incr_nest) // end of a scalar inside array, object or tag
1870 289 298 if (*p > 0x20)
1872 6 283 if (*p == '#')
1883 41 257 else if (!*p)
1891 0 0 if (!*p)
1904 9 36 if (*p == '\n')
1906 6 3 self->incr_mode = self->incr_mode == INCR_M_C0 ? INCR_M_WS : INCR_M_JSON;
1909 0 36 else if (!*p)
1921 105 35 switch (*p++)
1937 93 391 switch (*p++)
1956 581 1492 if (*p == '"')
1961 496 996 else if (*p == '\\')
1965 0 496 if (!*p) // if at end of string we have to switch modes
1971 0 996 else if (!*p)
1992 0 682 if (!self->incr_nest)
2021 1 354 if (++self->incr_nest > self->max_depth)
2027 253 99 if (--self->incr_nest <= 0)
2061 6400 25 for (i = 0; i < 256; ++i)
2062 5200 1200 decode_hexdigit [i] =
3975 2175 decode_hexdigit [i] =
4625 1375 decode_hexdigit [i] =
2063 250 4950 i >= '0' && i <= '9' ? i - '0'
2064 150 3825 : i >= 'a' && i <= 'f' ? i - 'a' + 10
2065 150 4475 : i >= 'A' && i <= 'F' ? i - 'A' + 10
2097 0 43129 XPUSHs (sv_2mortal (sv_bless (
0 43129 XPUSHs (sv_2mortal (sv_bless (
2107 0 0 XPUSHs (ST (0));
2111 0 0 if (self->v_false && self->v_true)
0 0 if (self->v_false && self->v_true)
2113 0 0 EXTEND (SP, 2);
2137 61577 15366 if (enable)
2142 0 76943 XPUSHs (ST (0));
2162 0 0 XPUSHs (boolSV (self->flags & ix));
0 0 XPUSHs (boolSV (self->flags & ix));
2167 0 5 XPUSHs (ST (0));
2178 0 3 XPUSHs (ST (0));
2190 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;
2192 0 3 XPUSHs (ST (0));
2198 1 3 if (!self->cb_sk_object)
2201 1 3 if (SvOK (cb))
1 0 if (SvOK (cb))
0 1 if (SvOK (cb))
2207 0 1 if (!HvKEYS (self->cb_sk_object))
0 1 if (!HvKEYS (self->cb_sk_object))
2214 0 4 XPUSHs (ST (0));
2220 0 24908 XPUSHs (scalar);
2225 0 18664 XPUSHs (jsonstr);
2233 0 2 EXTEND (SP, 2);
2235 2 0 PUSHs (sv_2mortal (newSVuv (ptr_to_index (jsonstr, SvPV_nolen (jsonstr) + offset))));
2241 25 641 if (!self->incr_text)
2245 25 641 if (!DECODE_WANTS_OCTETS (self) == !SvUTF8 (self->incr_text))
2246 0 25 if (DECODE_WANTS_OCTETS (self))
2248 0 0 if (self->incr_pos)
2258 0 25 if (self->incr_pos)
2264 347 319 if (jsonstr)
2267 346 1 if (SvUTF8 (jsonstr) != SvUTF8 (self->incr_text))
2268 0 346 if (SvUTF8 (jsonstr))
2276 347 0 const char *str = SvPV (jsonstr, len);
2279 155 192 if (SvLEN (self->incr_text) - cur <= len)
2288 666 0 if (GIMME_V != G_VOID)
326 340 if (GIMME_V != G_VOID)
2294 325 2 if (!INCR_DONE (self))
324 1 if (!INCR_DONE (self))
2298 287 38 if (self->incr_pos > self->max_size && self->max_size)
1 286 if (self->incr_pos > self->max_size && self->max_size)
2302 322 2 if (!INCR_DONE (self))
41 281 if (!INCR_DONE (self))
2305 41 2 if (self->incr_mode == INCR_M_WS && self->incr_pos)
4 37 if (self->incr_mode == INCR_M_WS && self->incr_pos)
2316 0 279 XPUSHs (sv);
2324 279 0 while (GIMME_V == G_ARRAY);
1 278 while (GIMME_V == G_ARRAY);
2331 0 304 if (self->incr_pos)
2334 304 0 RETVAL = self->incr_text ? SvREFCNT_inc (self->incr_text) : &PL_sv_undef;
2342 2 0 if (self->incr_pos)
2344 2 0 sv_chop (self->incr_text, SvPV_nolen (self->incr_text) + self->incr_pos);
2378 0 183 XPUSHs (scalar);
2388 0 6196 XPUSHs (jsonstr);