develooper Front page | perl.perl5.porters | Postings from March 2014

[perl #116925] document/publicize THINKFIRST

Thread Previous
Tony Cook via RT
March 26, 2014 05:08
[perl #116925] document/publicize THINKFIRST
Message ID:
On Wed Feb 05 01:57:24 2014, bulk88 wrote:
> The problem is SvPV_force_nolen and SvPVbyte_force_nolen do something
> totally useless if you just want to write into them. If I am going to
> just write, why do I want to A. copy the COW contents to a new non-COW
> block, B. convert encodings, then write over it? I want a
> uninitialized PV. sv_force_normal() copies the COW data over. Some
> people want R/W buffers to manipulate in place the data too.

I think:

  sv_force_normal_flags(sv, SV_COW_DROP_PV);
  SvUPGRADE(sv, SVt_PV);
  // SvGROW etc

is the answer there, though the name of the flag leaves something to desire,
since it doesn't just drop the PV for COW, but also for REGEXP and GLOB


via perlbug:  queue: perl5 status: open

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About