SvIsUV_on(dstr);
SvIV_set(dstr, SvIVX(sstr));
}
- if (SvVOK(sstr)) {
- const MAGIC * const smg = mg_find(sstr,PERL_MAGIC_vstring);
- sv_magic(dstr, NULL, PERL_MAGIC_vstring,
- smg->mg_ptr, smg->mg_len);
- SvRMAGICAL_on(dstr);
+ {
+ const MAGIC * const smg = SvVOK(sstr);
+ if (smg) {
+ sv_magic(dstr, NULL, PERL_MAGIC_vstring,
+ smg->mg_ptr, smg->mg_len);
+ SvRMAGICAL_on(dstr);
+ }
}
}
else if (sflags & SVp_IOK) {
SVf_IVisUV), \
SvFLAGS(sv) |= (SVf_POK|SVp_POK))
-#define SvVOK(sv) (SvMAGICAL(sv) && mg_find(sv,'V'))
+#define SvVOK(sv) (SvMAGICAL(sv) \
+ ? mg_find(sv,PERL_MAGIC_vstring) : NULL)
#define SvOOK(sv) (SvFLAGS(sv) & SVf_OOK)
#define SvOOK_on(sv) ((void)SvIOK_off(sv), SvFLAGS(sv) |= SVf_OOK)
#define SvOOK_off(sv) ((void)(SvOOK(sv) && sv_backoff(sv)))
return rv;
}
#ifdef SvVOK
- if ( SvVOK(ver) ) { /* already a v-string */
- const MAGIC* const mg = mg_find(ver,PERL_MAGIC_vstring);
- const STRLEN len = mg->mg_len;
- char * const version = savepvn( (const char*)mg->mg_ptr, len);
- sv_setpvn(rv,version,len);
- Safefree(version);
- }
- else {
+ {
+ const MAGIC* const mg = SvVOK(ver);
+ if ( mg ) { /* already a v-string */
+ const STRLEN len = mg->mg_len;
+ char * const version = savepvn( (const char*)mg->mg_ptr, len);
+ sv_setpvn(rv,version,len);
+ Safefree(version);
+ }
+ else {
#endif
- sv_setsv(rv,ver); /* make a duplicate */
+ sv_setsv(rv,ver); /* make a duplicate */
#ifdef SvVOK
+ }
}
#endif
return upg_version(rv);
{
const char *version, *s;
bool qv = 0;
+#ifdef SvVOK
+ const MAGIC *mg;
+#endif
if ( SvNOK(ver) ) /* may get too much accuracy */
{
version = savepvn(tbuf, len);
}
#ifdef SvVOK
- else if ( SvVOK(ver) ) { /* already a v-string */
- const MAGIC* const mg = mg_find(ver,PERL_MAGIC_vstring);
+ else if ( (mg = SvVOK(ver)) ) { /* already a v-string */
version = savepvn( (const char*)mg->mg_ptr,mg->mg_len );
qv = 1;
}