Branch Coverage

perl_libyaml.c
Criterion Covered Total %
branch 450 768 58.5


line true false branch
87 0 4 if (count > 1) {
94 0 0 for(i = 1; i <= count; i++) {
96 0 0 if (SvOK(sv) && !av_store(av, count - i, SvREFCNT_inc(sv)))
0 0 if (SvOK(sv) && !av_store(av, count - i, SvREFCNT_inc(sv)))
0 0 if (SvOK(sv) && !av_store(av, count - i, SvREFCNT_inc(sv)))
0 0 if (SvOK(sv) && !av_store(av, count - i, SvREFCNT_inc(sv)))
103 0 0 if (!SvOK(sv) || sv == &PL_sv_undef) {
0 0 if (!SvOK(sv) || sv == &PL_sv_undef) {
0 0 if (!SvOK(sv) || sv == &PL_sv_undef) {
0 0 if (!SvOK(sv) || sv == &PL_sv_undef) {
111 4 0 if (count)
123 4 0 I32 count = args ? av_len(args) : -1;
126 0 4 PUSHMARK(SP);
127 4 4 for (i = 0; i <= count; i++) {
128 4 0 if ((svp = av_fetch(args, i, FALSE))) {
129 0 4 XPUSHs(*svp);
144 4 0 if ((coderef = get_sv(perl_var, FALSE))
145 4 0 && SvROK(coderef)
146 4 0 && SvTYPE(SvRV(coderef)) == SVt_PVCV)
159 6 2 if (!problem)
161 0 8 if (self->filename)
162 0 0 msg = form("%s%s at file %s",
165 8 0 msg = form("%s%s at document %d",
167 4 4 if (self->parser.problem_mark.line ||
1 3 if (self->parser.problem_mark.line ||
173 1 2 else if (self->parser.problem_offset)
177 4 4 if (self->parser.context)
197 0 109 if ((int)self->encoding)
214 0 87 if ((int)self->encoding)
216 0 87 if ((int)self->linebreak)
234 1 108 if (!yaml_parser_parse(&self->parser, &self->event))
236 0 108 if (self->event.type != YAML_STREAM_START_EVENT)
242 108 7 XCPT_TRY_START {
249 1 213 if (!yaml_parser_parse(&self->parser, &self->event))
251 101 112 if (self->event.type == YAML_STREAM_END_EVENT)
257 0 106 if (! node) break;
258 0 106 XPUSHs(sv_2mortal(node));
259 0 106 if (!yaml_parser_parse(&self->parser, &self->event))
261 0 106 if (self->event.type != YAML_DOCUMENT_END_EVENT)
266 0 101 if (self->event.type != YAML_STREAM_END_EVENT)
272 7 101 XCPT_CATCH
275 7 0 XCPT_RETHROW;
0 0 XCPT_RETHROW;
300 2 3 if (SvROK(sv_file)) { /* pv mg or io or gv */
303 0 2 if (SvTYPE(rv) == SVt_PVIO) {
308 2 0 } else if (SvTYPE(rv) == SVt_PVGV && GvIO(rv)) {
2 0 } else if (SvTYPE(rv) == SVt_PVGV && GvIO(rv)) {
0 2 } else if (SvTYPE(rv) == SVt_PVGV && GvIO(rv)) {
0 0 } else if (SvTYPE(rv) == SVt_PVGV && GvIO(rv)) {
2 0 } else if (SvTYPE(rv) == SVt_PVGV && GvIO(rv)) {
2 0 } else if (SvTYPE(rv) == SVt_PVGV && GvIO(rv)) {
313 0 0 } else if (SvMAGIC(rv)) {
315 0 0 fname = SvPV_const(rv, len);
317 0 0 } else if (SvAMAGIC(sv_file)) {
0 0 } else if (SvAMAGIC(sv_file)) {
0 0 } else if (SvAMAGIC(sv_file)) {
318 0 0 fname = SvPV_const(sv_file, len);
325 3 0 else if (SvPOK(sv_file)) {
326 3 0 fname = SvPV_const(sv_file, len);
329 0 3 if (!file) {
335 0 0 } else if (SvTYPE(sv_file) == SVt_PVIO) {
340 0 0 } else if (SvTYPE(sv_file) == SVt_PVGV
341 0 0 && GvIO(sv_file)) {
0 0 && GvIO(sv_file)) {
0 0 && GvIO(sv_file)) {
0 0 && GvIO(sv_file)) {
0 0 && GvIO(sv_file)) {
352 3 2 if (file)
354 0 2 else if (SvTYPE(sv_file) == SVt_PVIO)
369 103 1 yaml_str = (const unsigned char *)SvPV_const(yaml_sv, yaml_len);
372 0 104 if (DO_UTF8(yaml_sv)) { /* overrides encoding setting */
0 0 if (DO_UTF8(yaml_sv)) { /* overrides encoding setting */
373 0 0 if (self->encoding == YAML_ANY_ENCODING)
398 4 617 if (!yaml_parser_parse(&self->parser, &self->event))
403 0 617 if (self->event.type == YAML_NO_EVENT)
407 617 0 if (self->event.type == YAML_DOCUMENT_END_EVENT ||
543 74 if (self->event.type == YAML_DOCUMENT_END_EVENT ||
408 52 491 self->event.type == YAML_MAPPING_END_EVENT ||
424 32 45 if (tag) {
426 16 16 if (strEQ(tag, TAG_PERL_REF)) {
431 0 16 if (strEQ(tag, TAG_PERL_GLOB)) {
483 61 0 if (!tag)
487 5 56 if (anchor)
492 111 58 while ((key_node = load_node(self))) {
499 16 42 if (tag) {
500 14 2 if (strEQ(tag, TAG_PERL_PREFIX "hash")) {
502 13 1 else if (strEQ(tag, YAML_MAP_TAG)) {
507 3 10 if (*tag == '!') {
510 9 1 else if (strlen(tag) <= strlen(prefix) ||
0 9 else if (strlen(tag) <= strlen(prefix) ||
514 10 2 if (!(self->flags & F_DISABLEBLESSED)) {
516 2 8 if (self->flags & F_SAFEMODE &&
2 0 if (self->flags & F_SAFEMODE &&
517 1 1 (!self->safeclasses ||
542 2 50 if (anchor)
545 127 52 while ((node = load_node(self))) {
548 13 39 if (tag) {
549 11 2 if (strEQ(tag, TAG_PERL_PREFIX "array")) {
551 10 1 else if (strEQ(tag, YAML_SEQ_TAG)) {
557 3 7 if (*tag == '!')
559 6 1 else if (strlen(tag) <= strlen(prefix) ||
0 6 else if (strlen(tag) <= strlen(prefix) ||
563 7 2 if (!(self->flags & F_DISABLEBLESSED)) {
565 2 5 if (self->flags & F_SAFEMODE &&
2 0 if (self->flags & F_SAFEMODE &&
566 1 1 (!self->safeclasses ||
591 37 309 if (tag) {
592 6 31 if (strEQ(tag, YAML_STR_TAG)) {
595 30 1 else if (strEQ(tag, YAML_INT_TAG) || strEQ(tag, YAML_FLOAT_TAG)) {
1 29 else if (strEQ(tag, YAML_INT_TAG) || strEQ(tag, YAML_FLOAT_TAG)) {
598 2 0 if ( looks_like_number(scalar) ) {
600 2 0 SvIV_please(scalar);
2 0 SvIV_please(scalar);
0 2 SvIV_please(scalar);
607 0 2 if (anchor)
612 4 25 else if (strEQ(tag, YAML_NULL_TAG) &&
3 1 else if (strEQ(tag, YAML_NULL_TAG) &&
613 2 1 (strEQ(string, "~") ||
614 2 0 strEQ(string, "null") ||
618 1 3 if (anchor)
626 11 14 if (strnEQ(tag, prefix, strlen(prefix)))
629 6 8 if (strnEQ(tag, prefix, strlen(prefix)))
632 3 5 if (*tag == '!')
634 5 0 else if (strlen(tag) <= strlen(prefix) ||
0 5 else if (strlen(tag) <= strlen(prefix) ||
638 6 2 if (!(self->flags & F_DISABLEBLESSED))
639 2 4 if (self->flags & F_SAFEMODE &&
2 0 if (self->flags & F_SAFEMODE &&
640 1 1 (!self->safeclasses ||
653 0 8 if (anchor)
660 281 28 else if (style == YAML_PLAIN_SCALAR_STYLE) {
661 274 7 if (strEQ(string, "~") || strEQ(string, "null") || strEQ(string, "")) {
272 2 if (strEQ(string, "~") || strEQ(string, "null") || strEQ(string, "")) {
8 264 if (strEQ(string, "~") || strEQ(string, "null") || strEQ(string, "")) {
663 3 14 if (anchor)
668 12 252 else if (strEQ(string, "true")) {
670 3 9 if (self->boolean == YAML_BOOLEAN_JSONPP) {
673 1 8 else if (self->boolean == YAML_BOOLEAN_BOOLEAN) {
681 1 11 if (anchor)
686 7 245 else if (strEQ(string, "false")) {
688 3 4 if (self->boolean == YAML_BOOLEAN_JSONPP) {
691 1 3 else if (self->boolean == YAML_BOOLEAN_BOOLEAN) {
699 1 6 if (anchor)
708 245 34 if (style == YAML_PLAIN_SCALAR_STYLE && looks_like_number(scalar) ) {
48 197 if (style == YAML_PLAIN_SCALAR_STYLE && looks_like_number(scalar) ) {
710 48 0 SvIV_please(scalar);
48 0 SvIV_please(scalar);
0 48 SvIV_please(scalar);
714 1 278 if (anchor)
739 0 11 PUSHMARK(sp);
740 0 11 XPUSHs(regexp);
747 11 0 FREETMPS;
750 3 8 if (strlen(tag) > strlen(prefix) && strnEQ(tag, prefix, strlen(prefix))) {
3 0 if (strlen(tag) > strlen(prefix) && strnEQ(tag, prefix, strlen(prefix))) {
751 2 1 if (!(self->flags & F_DISABLEBLESSED)) {
753 0 2 if (self->flags & F_SAFEMODE) {
767 1 10 if (anchor)
788 6 0 if (strlen(tag) > strlen(prefix) && strnEQ(tag, prefix, strlen(prefix))) {
6 0 if (strlen(tag) > strlen(prefix) && strnEQ(tag, prefix, strlen(prefix))) {
790 2 4 if (self->flags & F_SAFEMODE &&
2 0 if (self->flags & F_SAFEMODE &&
791 1 1 (!self->safeclasses ||
801 1 4 if (!(self->flags & F_LOADCODE)) {
812 0 5 PUSHMARK(sp);
813 0 5 XPUSHs(code);
820 5 0 FREETMPS;
823 4 1 if (strlen(tag) > strlen(prefix) && strnEQ(tag, prefix, strlen(prefix))) {
4 0 if (strlen(tag) > strlen(prefix) && strnEQ(tag, prefix, strlen(prefix))) {
824 4 0 if (!(self->flags & F_DISABLEBLESSED)) {
830 0 5 if (anchor)
845 16 0 if (entry)
859 2 14 if (anchor)
865 0 16 if (load_node(self))
912 103 83 for (i = yaml_ix; i < items; i++) {
928 83 0 if (yaml) {
931 0 83 XPUSHs(yaml);
959 2 2 if (SvROK(sv_file)) { /* pv mg or io or gv */
962 0 2 if (SvTYPE(rv) == SVt_PVIO) {
967 2 0 } else if (SvTYPE(rv) == SVt_PVGV && GvIO(rv)) {
2 0 } else if (SvTYPE(rv) == SVt_PVGV && GvIO(rv)) {
0 2 } else if (SvTYPE(rv) == SVt_PVGV && GvIO(rv)) {
0 0 } else if (SvTYPE(rv) == SVt_PVGV && GvIO(rv)) {
2 0 } else if (SvTYPE(rv) == SVt_PVGV && GvIO(rv)) {
2 0 } else if (SvTYPE(rv) == SVt_PVGV && GvIO(rv)) {
972 0 0 } else if (SvMAGIC(rv)) {
974 0 0 fname = SvPV_const(rv, len);
976 0 0 } else if (SvAMAGIC(sv_file)) {
0 0 } else if (SvAMAGIC(sv_file)) {
0 0 } else if (SvAMAGIC(sv_file)) {
977 0 0 fname = SvPV_const(sv_file, len);
984 2 0 else if (SvPOK(sv_file)) {
985 2 0 fname = (const char *)SvPV_const(sv_file, len);
988 0 2 if (!file) {
994 0 0 } else if (SvTYPE(sv_file) == SVt_PVIO) {
999 0 0 } else if (SvTYPE(sv_file) == SVt_PVGV && GvIO(sv_file)) {
0 0 } else if (SvTYPE(sv_file) == SVt_PVGV && GvIO(sv_file)) {
0 0 } else if (SvTYPE(sv_file) == SVt_PVGV && GvIO(sv_file)) {
0 0 } else if (SvTYPE(sv_file) == SVt_PVGV && GvIO(sv_file)) {
0 0 } else if (SvTYPE(sv_file) == SVt_PVGV && GvIO(sv_file)) {
0 0 } else if (SvTYPE(sv_file) == SVt_PVGV && GvIO(sv_file)) {
1012 0 4 if (!yaml_emitter_emit(&self->emitter, &event_stream_start)) {
1021 6 4 for (i = yaml_ix+1; i < items; i++) {
1033 0 4 if (!yaml_emitter_emit(&self->emitter, &event_stream_end)) {
1038 2 2 if (file)
1040 0 2 else if (SvTYPE(sv_file) == SVt_PVIO)
1059 163 143 if (! (SvROK(node) || SvTYPE(node) == SVt_PVGV)) return;
158 5 if (! (SvROK(node) || SvTYPE(node) == SVt_PVGV)) return;
1062 143 5 SV *object = SvROK(node) ? SvRV(node) : node;
1065 17 131 if (seen) {
1066 16 1 if (*seen == &PL_sv_undef) {
1076 2 129 if (SvTYPE(node) == SVt_PVGV) {
1081 44 87 if (ref_type == SVt_PVAV) {
1084 91 44 for (i = 0; i < array_size; i++) {
1086 91 0 if (entry)
1090 47 40 else if (ref_type == SVt_PVHV) {
1094 93 47 while ((he = hv_iternext(hash))) {
1096 87 6 if (val)
1100 24 16 else if (ref_type <= SVt_PVNV || ref_type == SVt_PVGV) {
3 21 else if (ref_type <= SVt_PVNV || ref_type == SVt_PVGV) {
1126 5 394 if (SvTYPE(node) == SVt_PVGV) {
1130 3 2 if (anchor && strEQ((char *)anchor, ""))
3 0 if (anchor && strEQ((char *)anchor, ""))
1133 2 0 if (svr) {
1138 145 251 if (SvROK(node)) {
1141 52 93 if (ref_type == SVt_PVHV)
1143 50 43 else if (ref_type == SVt_PVAV)
1145 25 18 else if (ref_type <= SVt_PVNV || ref_type == SVt_PVGV)
4 21 else if (ref_type <= SVt_PVNV || ref_type == SVt_PVGV)
1147 5 16 else if (ref_type == SVt_PVCV)
1149 10 6 else if (ref_type == SVt_PVMG) {
1152 0 10 if (SvMAGICAL(rnode)) {
1153 0 0 if ((mg = mg_find(rnode, PERL_MAGIC_qr))) {
1156 0 0 if (!strEQ(klass, "Regexp"))
1163 8 2 if (self->boolean != YAML_BOOLEAN_NONE) {
1164 0 8 if (SvIV(node))
4 4 if (SvIV(node))
1179 6 0 else if (ref_type == SVt_REGEXP) {
1182 1 5 if (!strEQ(klass, "Regexp"))
1204 127 2 if (seen && *seen != &PL_sv_undef) {
33 94 if (seen && *seen != &PL_sv_undef) {
1205 16 17 if (*seen == &PL_sv_yes) {
1209 0 16 return (yaml_char_t*)SvPV_nolen(iv);
1212 17 0 yaml_char_t *anchor = (yaml_char_t *)SvPV_nolen(*seen);
1228 81 13 if (! (sv_isobject(node)
81 0 if (! (sv_isobject(node)
1229 80 1 || (SvRV(node) && ( SvTYPE(SvRV(node)) == SVt_PVCV))))
1242 1 4 if (strEQ(klass, "CODE"))
1251 0 14 if (!tag)
1268 52 0 if (!anchor)
1270 10 42 if (anchor && strEQ((char*)anchor, ""))
5 5 if (anchor && strEQ((char*)anchor, ""))
1273 45 2 if (!tag)
1275 8 39 if (tag && self->flags & F_SAFEMODE) {
1 7 if (tag && self->flags & F_SAFEMODE) {
1279 0 1 if (SvOBJECT(node)) {
1281 0 0 klass = HvNAME_get(stash);
0 0 klass = HvNAME_get(stash);
0 0 klass = HvNAME_get(stash);
0 0 klass = HvNAME_get(stash);
0 0 klass = HvNAME_get(stash);
0 0 klass = HvNAME_get(stash);
1282 0 0 len = HvNAMELEN_get(stash);
0 0 len = HvNAMELEN_get(stash);
0 0 len = HvNAMELEN_get(stash);
0 0 len = HvNAMELEN_get(stash);
0 0 len = HvNAMELEN_get(stash);
0 0 len = HvNAMELEN_get(stash);
1283 0 0 if (HvNAMEUTF8(stash))
0 0 if (HvNAMEUTF8(stash))
0 0 if (HvNAMEUTF8(stash))
0 0 if (HvNAMEUTF8(stash))
0 0 if (HvNAMEUTF8(stash))
0 0 if (HvNAMEUTF8(stash))
0 0 if (HvNAMEUTF8(stash))
1303 90 47 while ((he = hv_iternext(hash))) {
1309 90 47 for (i = 0; i < len; i++) {
1312 90 0 SV *val = he ? HeVAL(he) : NULL;
1313 0 90 if (val == NULL)
1336 12 38 if (anchor && strEQ((char *)anchor, ""))
6 6 if (anchor && strEQ((char *)anchor, ""))
1339 3 41 if (tag && self->flags & F_SAFEMODE) {
1 2 if (tag && self->flags & F_SAFEMODE) {
1343 0 1 if (SvOBJECT(node)) {
1345 0 0 klass = HvNAME_get(stash);
0 0 klass = HvNAME_get(stash);
0 0 klass = HvNAME_get(stash);
0 0 klass = HvNAME_get(stash);
0 0 klass = HvNAME_get(stash);
0 0 klass = HvNAME_get(stash);
1346 0 0 len = HvNAMELEN_get(stash);
0 0 len = HvNAMELEN_get(stash);
0 0 len = HvNAMELEN_get(stash);
0 0 len = HvNAMELEN_get(stash);
0 0 len = HvNAMELEN_get(stash);
0 0 len = HvNAMELEN_get(stash);
1347 0 0 if (HvNAMEUTF8(stash))
0 0 if (HvNAMEUTF8(stash))
0 0 if (HvNAMEUTF8(stash))
0 0 if (HvNAMEUTF8(stash))
0 0 if (HvNAMEUTF8(stash))
0 0 if (HvNAMEUTF8(stash))
0 0 if (HvNAMEUTF8(stash))
1364 91 44 for (i = 0; i < array_size; i++) {
1366 0 91 if (entry == NULL)
1384 8 259 if (tag) {
1385 1 7 if (self->flags & F_SAFEMODE && SvOBJECT(node)) {
1 0 if (self->flags & F_SAFEMODE && SvOBJECT(node)) {
1387 1 0 char *klass = HvNAME_get(stash);
1 0 char *klass = HvNAME_get(stash);
0 1 char *klass = HvNAME_get(stash);
0 0 char *klass = HvNAME_get(stash);
1 0 char *klass = HvNAME_get(stash);
0 1 char *klass = HvNAME_get(stash);
1388 1 0 STRLEN len = HvNAMELEN_get(stash);
1 0 STRLEN len = HvNAMELEN_get(stash);
0 1 STRLEN len = HvNAMELEN_get(stash);
0 0 STRLEN len = HvNAMELEN_get(stash);
1 0 STRLEN len = HvNAMELEN_get(stash);
0 1 STRLEN len = HvNAMELEN_get(stash);
1389 1 0 if (HvNAMEUTF8(stash))
1 0 if (HvNAMEUTF8(stash))
0 1 if (HvNAMEUTF8(stash))
1 0 if (HvNAMEUTF8(stash))
0 1 if (HvNAMEUTF8(stash))
0 1 if (HvNAMEUTF8(stash))
0 1 if (HvNAMEUTF8(stash))
1407 6 261 SvGETMAGIC(node);
0 6 SvGETMAGIC(node);
1408 6 261 if (!SvOK(node)) {
6 0 if (!SvOK(node)) {
6 0 if (!SvOK(node)) {
1413 6 255 else if (node == &PL_sv_yes) {
1418 6 249 else if (node == &PL_sv_no) {
1425 207 42 string = SvPV_nomg(node_clone, string_len);
1426 244 5 if (
1427 41 203 (string_len == 0) ||
1428 40 1 (string_len == 1 && strEQ(string, "~")) ||
25 218 (string_len == 1 && strEQ(string, "~")) ||
1429 20 5 (string_len == 4 &&
1430 20 0 (strEQ(string, "true") || strEQ(string, "null"))) ||
22 216 (strEQ(string, "true") || strEQ(string, "null"))) ||
1431 17 5 (string_len == 5 && strEQ(string, "false")) ||
233 0 (string_len == 5 && strEQ(string, "false")) ||
1432 226 7 (SvTYPE(node_clone) >= SVt_PVGV) ||
1433 180 46 ( (self->flags & F_QUOTENUM) &&
1434 4 176 !SvNIOK(node_clone) &&
1439 200 29 if (!SvUTF8(node_clone)) {
1444 0 200 string = SvPVutf8(utf8sv, string_len);
1446 4 225 if(strchr(string, '\n'))
1447 1 3 style = (string_len > 30) ? YAML_LITERAL_SCALAR_STYLE
1460 0 267 if (! yaml_emitter_emit(&self->emitter, &event_scalar))
1475 3 2 if (self->flags & F_DUMPCODE) {
1480 2 1 if (self->flags & F_SAFEMODE) {
1485 2 0 : GvSTASH(CvGV(rnode));
1486 0 2 if (!stash)
1488 2 0 klass = HvNAME_get(stash);
2 0 klass = HvNAME_get(stash);
0 2 klass = HvNAME_get(stash);
0 0 klass = HvNAME_get(stash);
2 0 klass = HvNAME_get(stash);
0 2 klass = HvNAME_get(stash);
1489 2 0 len = HvNAMELEN_get(stash);
2 0 len = HvNAMELEN_get(stash);
0 2 len = HvNAMELEN_get(stash);
0 0 len = HvNAMELEN_get(stash);
2 0 len = HvNAMELEN_get(stash);
0 2 len = HvNAMELEN_get(stash);
1490 2 0 if (HvNAMEUTF8(stash))
2 0 if (HvNAMEUTF8(stash))
0 2 if (HvNAMEUTF8(stash))
2 0 if (HvNAMEUTF8(stash))
0 2 if (HvNAMEUTF8(stash))
0 2 if (HvNAMEUTF8(stash))
0 2 if (HvNAMEUTF8(stash))
1492 2 0 if (!self->safeclasses || !hv_exists(self->safeclasses, klass, len)) {
1 1 if (!self->safeclasses || !hv_exists(self->safeclasses, klass, len)) {
1500 2 1 if (result != &PL_sv_undef) {
1506 3 0 if (result && result != &PL_sv_undef) {
2 1 if (result && result != &PL_sv_undef) {
1507 2 0 string = SvPV_nolen(result);
1512 5 0 yaml_scalar_event_initialize(
1549 8 14 if (anchor && strEQ((char *)anchor, ""))
3 5 if (anchor && strEQ((char *)anchor, ""))
1605 0 23 if (!self)