diff options
author | David Mitchell <davem@iabyn.com> | 2017-06-12 13:31:22 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2017-06-12 21:11:02 +0100 |
commit | fa531f329e4f1fbd1d51dc1d40cc900089487939 (patch) | |
tree | 2ac6f4bd81c04626552f0f79c9298d0c65e2ebe4 /mg.c | |
parent | 522dba3426c18f53b5e3a09c16b13670d4bafd6d (diff) | |
download | perl-fa531f329e4f1fbd1d51dc1d40cc900089487939.tar.gz |
gv.c, mg.c: fix 32-bit compiler warnings
mg.c:641:21: warning: cast from pointer to integer of different size
[-Wpointer-to-int-cast]
UV uv = (UV)mg->mg_obj;
It's storing a char-ranged integer value as an SV*. By using SSize_t
rather than UV to store the char, it avoids mismatched size warnings.
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -638,8 +638,8 @@ Perl_magic_regdata_cnt(pTHX_ SV *sv, MAGIC *mg) if (PL_curpm) { REGEXP * const rx = PM_GETRE(PL_curpm); if (rx) { - UV uv = (UV)mg->mg_obj; - if (uv == '+') { /* @+ */ + const SSize_t n = (SSize_t)mg->mg_obj; + if (n == '+') { /* @+ */ /* return the number possible */ return RX_NPARENS(rx); } else { /* @- @^CAPTURE @{^CAPTURE} */ @@ -650,7 +650,7 @@ Perl_magic_regdata_cnt(pTHX_ SV *sv, MAGIC *mg) && (RX_OFFS(rx)[paren].start == -1 || RX_OFFS(rx)[paren].end == -1) ) paren--; - if (uv == '-') { + if (n == '-') { /* @- */ return (U32)paren; } else { @@ -674,10 +674,10 @@ Perl_magic_regdatum_get(pTHX_ SV *sv, MAGIC *mg) if (PL_curpm) { REGEXP * const rx = PM_GETRE(PL_curpm); if (rx) { - const UV uv = (UV)mg->mg_obj; + const SSize_t n = (SSize_t)mg->mg_obj; /* @{^CAPTURE} does not contain $&, so we need to increment by 1 */ const I32 paren = mg->mg_len - + (uv == '\003' ? 1 : 0); + + (n == '\003' ? 1 : 0); SSize_t s; SSize_t t; if (paren < 0) @@ -688,9 +688,9 @@ Perl_magic_regdatum_get(pTHX_ SV *sv, MAGIC *mg) { SSize_t i; - if (uv == '+') /* @+ */ + if (n == '+') /* @+ */ i = t; - else if (uv == '-') /* @- */ + else if (n == '-') /* @- */ i = s; else { /* @^CAPTURE @{^CAPTURE} */ CALLREG_NUMBUF_FETCH(rx,paren,sv); |