diff options
author | Brian Fraser <fraserbn@gmail.com> | 2012-05-26 17:35:26 -0300 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-05-26 14:46:22 -0700 |
commit | 032061d233a4bb16c1677ef64615bdb15de5b8a1 (patch) | |
tree | 25fb6c784794d445049061349684d775ad91de15 /doop.c | |
parent | 5204593b74eb08fdcf425b7e9802a23ae74ee094 (diff) | |
download | perl-032061d233a4bb16c1677ef64615bdb15de5b8a1.tar.gz |
Fix for [perl #9423] vec assignments generate 2 warnings
Before this commit, this:
vec(my $v,0,1) = 1;
would've produced four warnings about uninitialized values;
however, the ticket argued that these were spurious.
This commit removes the warning in the case of lvalue vec, since it is
similar to |=, but leaves it in place for rvalue vec.
Diffstat (limited to 'doop.c')
-rw-r--r-- | doop.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -764,9 +764,15 @@ Perl_do_vecget(pTHX_ SV *sv, SSize_t offset, int size) { dVAR; STRLEN srclen, len, uoffset, bitoffs = 0; - const unsigned char *s = (const unsigned char *) SvPV_const(sv, srclen); + const unsigned char *s = (const unsigned char *) SvPV_flags_const(sv, srclen, + SV_GMAGIC | ((PL_op->op_flags & OPf_MOD || LVRET) + ? SV_UNDEF_RETURNS_NULL : 0)); UV retnum = 0; + if (!s) { + s = (const unsigned char *)""; + } + PERL_ARGS_ASSERT_DO_VECGET; if (offset < 0) @@ -921,7 +927,8 @@ Perl_do_vecset(pTHX_ SV *sv) if (!targ) return; - s = (unsigned char*)SvPV_force(targ, targlen); + s = (unsigned char*)SvPV_force_flags(targ, targlen, + SV_GMAGIC | SV_UNDEF_RETURNS_NULL); if (SvUTF8(targ)) { /* This is handled by the SvPOK_only below... if (!Perl_sv_utf8_downgrade(aTHX_ targ, TRUE)) |