Branch Coverage

src/xs/lib/clone.cc
Criterion Covered Total %
branch 73 110 66.3


line true false branch
26 5 28 if (cross) {
27 0 2 CloneMap map;
29 5 0 _clone(aTHX_ ret, source, mapref, 0);
31 26 2 else _clone(aTHX_ ret, source, mapref, 0);
33 2 0 SvREFCNT_dec(ret);
40 2 40104 if (depth > CLONE_MAX_DEPTH) throw 1;
42 10034 30070 if (SvROK(source)) { // reference
46 10033 1 if (unlikely(val_type == SVt_PVCV || val_type == SVt_PVIO)) { // CV and IO cannot be copied - just set reference to the same SV
1 10032 if (unlikely(val_type == SVt_PVCV || val_type == SVt_PVIO)) { // CV and IO cannot be copied - just set reference to the same SV
2 10032 if (unlikely(val_type == SVt_PVCV || val_type == SVt_PVIO)) { // CV and IO cannot be copied - just set reference to the same SV
47 2 0 SvSetSV_nosteal(dest, source);
2 0 SvSetSV_nosteal(dest, source);
52 15 10017 if (map) {
53 15 0 CloneMap::iterator it = map->find(id);
54 4 11 if (it != map->end()) {
55 4 0 SvSetSV_nosteal(dest, it->second);
4 0 SvSetSV_nosteal(dest, it->second);
64 5008 5020 if (is_object) {
65 5008 0 auto mg = mg_findext(source_val, PERL_MAGIC_ext, &clone_marker);
66 2 5006 if (mg) {
69 5006 0 else if ((cloneGV = gv_fetchmeth(SvSTASH(source_val), HOOK_METHOD, HOOK_METHLEN, 0))) {
3 5003 else if ((cloneGV = gv_fetchmeth(SvSTASH(source_val), HOOK_METHOD, HOOK_METHLEN, 0))) {
71 3 0 sv_magicext(source_val, NULL, PERL_MAGIC_ext, &clone_marker, (const char*)map, 0);
72 3 0 dSP; ENTER; SAVETMPS;
3 0 dSP; ENTER; SAVETMPS;
73 0 3 PUSHMARK(SP);
0 0 PUSHMARK(SP);
74 0 3 XPUSHs(source);
0 0 XPUSHs(source);
76 3 0 int count = call_sv((SV*)GvCV(cloneGV), G_SCALAR);
79 3 3 while (count--) retval = POPs;
80 3 0 if (retval) SvSetSV(dest, retval);
3 0 if (retval) SvSetSV(dest, retval);
3 0 if (retval) SvSetSV(dest, retval);
82 3 0 FREETMPS; LEAVE;
3 0 FREETMPS; LEAVE;
3 0 FREETMPS; LEAVE;
84 3 0 sv_unmagicext(source_val, PERL_MAGIC_ext, &clone_marker);
85 1 2 if (map) (*map)[id] = dest;
1 0 if (map) (*map)[id] = dest;
90 10025 0 SV* refval = newSV(0);
91 10025 0 sv_upgrade(dest, SVt_RV);
95 5005 5020 if (is_object) sv_bless(dest, SvSTASH(source_val)); // cloning an object without any specific clone behavior
5005 0 if (is_object) sv_bless(dest, SvSTASH(source_val)); // cloning an object without any specific clone behavior
96 10 10015 if (map) (*map)[id] = dest;
10 0 if (map) (*map)[id] = dest;
97 5023 5002 _clone(aTHX_ refval, source_val, map, depth+1);
113 20045 0 SvSetSV_nosteal(dest, source);
128 15024 5009 for (SSize_t i = 0; i <= srcfill; ++i) {
130 15024 0 if (srcval != NULL) { // if not empty slot
142 0 5014 if (!hvarr) return;
144 30114 16 for (STRLEN i = 0; i <= hvmax; ++i) {
146 15024 25116 for (entry = hvarr[i]; entry; entry = HeNEXT(entry)) {
162 11 0 }}
11 0 }}