|
6 | 6 | #define NEED_my_sprintf
|
7 | 7 | #define NEED_sv_2pv_flags
|
8 | 8 | #define NEED_utf8_to_uvchr_buf
|
| 9 | +#define NEED_sv_vstring_get |
9 | 10 | #include "ppport.h"
|
10 | 11 |
|
11 | 12 | #ifndef strlcpy
|
@@ -1240,7 +1241,8 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
|
1240 | 1241 | }
|
1241 | 1242 | else {
|
1242 | 1243 | STRLEN i;
|
1243 |
| - const MAGIC *mg; |
| 1244 | + STRLEN vstr_len; |
| 1245 | + const char *vstr_pv; |
1244 | 1246 |
|
1245 | 1247 | if (namelen) {
|
1246 | 1248 | id_buffer = PTR2UV(val);
|
@@ -1386,17 +1388,17 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
|
1386 | 1388 | sv_catpvs(retval, "undef");
|
1387 | 1389 | }
|
1388 | 1390 | #ifdef SvVOK
|
1389 |
| - else if (SvMAGICAL(val) && (mg = mg_find(val, PERL_MAGIC_vstring))) { |
| 1391 | + else if (SvVOK(val) && (vstr_pv = SvVSTRING(val, vstr_len))) { |
1390 | 1392 | # if !defined(PL_vtbl_vstring) && PERL_VERSION_LT(5,17,0)
|
1391 | 1393 | SV * const vecsv = sv_newmortal();
|
1392 | 1394 | # if PERL_VERSION_LT(5,10,0)
|
1393 |
| - scan_vstring(mg->mg_ptr, vecsv); |
| 1395 | + scan_vstring(vstr_pv, vecsv); |
1394 | 1396 | # else
|
1395 |
| - scan_vstring(mg->mg_ptr, mg->mg_ptr + mg->mg_len, vecsv); |
| 1397 | + scan_vstring(vstr_pv, vstr_pv + vstr_len, vecsv); |
1396 | 1398 | # endif
|
1397 | 1399 | if (!sv_eq(vecsv, val)) goto integer_came_from_string;
|
1398 | 1400 | # endif
|
1399 |
| - sv_catpvn(retval, (const char *)mg->mg_ptr, mg->mg_len); |
| 1401 | + sv_catpvn(retval, vstr_pv, vstr_len); |
1400 | 1402 | }
|
1401 | 1403 | #endif
|
1402 | 1404 |
|
@@ -1701,13 +1703,13 @@ Data_Dumper__vstring(sv)
|
1701 | 1703 | CODE:
|
1702 | 1704 | {
|
1703 | 1705 | #ifdef SvVOK
|
1704 |
| - const MAGIC *mg; |
1705 |
| - RETVAL = |
1706 |
| - SvMAGICAL(sv) && (mg = mg_find(sv, PERL_MAGIC_vstring)) |
1707 |
| - ? newSVpvn((const char *)mg->mg_ptr, mg->mg_len) |
1708 |
| - : &PL_sv_undef; |
1709 |
| -#else |
1710 |
| - RETVAL = &PL_sv_undef; |
| 1706 | + if(SvVOK(sv)) { |
| 1707 | + STRLEN vstr_len; |
| 1708 | + const char *vstr_pv = SvVSTRING(sv, vstr_len); |
| 1709 | + RETVAL = newSVpvn(vstr_pv, vstr_len); |
| 1710 | + } |
| 1711 | + else |
1711 | 1712 | #endif
|
| 1713 | + RETVAL = &PL_sv_undef; |
1712 | 1714 | }
|
1713 | 1715 | OUTPUT: RETVAL
|
0 commit comments