| 1 |
|
| #include <xs/Scalar.h> |
| 2 |
|
| |
| 3 |
|
| namespace xs { |
| 4 |
|
| |
| 5 |
|
| const Scalar Scalar::undef(&PL_sv_undef); |
| 6 |
|
| const Scalar Scalar::yes(&PL_sv_yes); |
| 7 |
|
| const Scalar Scalar::no(&PL_sv_no); |
| 8 |
|
| |
| 9 |
128 |
| void Scalar::_validate_rest() { |
| 10 |
128 |
▶ | if (SvTYPE(sv) != SVt_PVLV) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvTYPE(sv) != SVt_PVLV) { |
122 |
6 |
128 |
|
| 11 |
122 |
| reset(); |
| 12 |
122 |
▶ | throw std::invalid_argument("SV is not a scalar value"); |
Branch: 1 branch
| Branch | True | False | Total |
| throw std::invalid_argument("SV is not a scalar value"); |
122 |
0 |
122 |
|
| 13 |
|
| } |
| 14 |
6 |
| auto newval = newSVsv(sv); |
| 15 |
6 |
| reset(); // remove old sv |
| 16 |
6 |
| sv = newval; // newSVsv creates sv with refcnt=1, so no inc is required |
| 17 |
6 |
| } |
| 18 |
|
| |
| 19 |
37 |
| void Scalar::__at_perl_destroy () { |
| 20 |
37 |
| const_cast<Scalar*>(&undef)->reset(); |
| 21 |
37 |
| const_cast<Scalar*>(&yes)->reset(); |
| 22 |
37 |
| const_cast<Scalar*>(&no)->reset(); |
| 23 |
37 |
| } |
| 24 |
|
| |
| 25 |
|
| } |