develooper Front page | perl.perl5.porters | Postings from June 2008

[PATCH] More COW lvalues

Thread Next
From:
Reini Urban
Date:
June 9, 2008 08:06
Subject:
[PATCH] More COW lvalues
Message ID:
484D46EB.9000800@x-ray.at
-DPERL_DEBUG_COW revealed more invalid lvalues, caused by Change #25571.

SvCUR= is relatively easy to fix because we have SvCUR_set.

op.c: In function `Perl_ck_require':
op.c:7525: error: invalid lvalue in assignment
make: *** [op.o] Error 1

diff -u sv.h.orig sv.h
--- sv.h.orig   2008-06-08 15:41:31.000000000 +0000
+++ sv.h        2008-06-09 14:52:57.187500000 +0000
@@ -1232,7 +1232,7 @@
                 (((XPV*)  SvANY(sv))->xpv_len = (val)); } STMT_END
  #define SvEND_set(sv, val) \
         STMT_START { assert(SvTYPE(sv) >= SVt_PV); \
-               (SvCUR(sv) = (val) - SvPVX(sv)); } STMT_END
+               SvCUR_set(sv, (val) - SvPVX(sv)); } STMT_END

  #define SvPV_renew(sv,n) \
         STMT_START { SvLEN_set(sv, n); \


But what about SvIVX(sv)++

regcomp.c: In function `S_reg':
regcomp.c:5672: error: invalid lvalue in increment
SvIVX(sv_dat)++;
regcomp.c:5678: error: invalid lvalue in assignment
SvIVX(sv_dat)= 1;

I can only think of disallowing the PERL_DEBUG_COW macro here.
This is ugly, but at least it works now.
-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About