develooper Front page | perl.perl5.porters | Postings from July 2016

Re: Indented here docs?

Thread Previous | Thread Next
Father Chrysostomos
July 2, 2016 17:07
Re: Indented here docs?
Message ID:
Matthew Horsfall wrote:
> Hrm... should we remove it?

Perl is currently inconsistent in how it handles line endings and
probably has been ever since those #ifndef PERL_STRICT_CR blocks were
added.  (Previously, before the #define existed, what is now called
PERL_STRICT_CR was the only mode.)

Having the #ifndefs is helpful in pointing out exactly which code
needs auditing, if someone does want to fix it.  So I think they
should stay, if only for documentation purposes.

> I would think not since the end of s and ss should contain a \0 and
> memEQ/ninstr should stop there, but I guess they'd keep going if
> PL_tokenbuf or indent somehow had a null byte in the middle...

Both memEQ and ninstr treat nulls like any other character, so, as
Zefram said, they need to be guarded.

> Also, am I leaking anything here?
>          sv_setsv(tmpstr,newstr);

I do not see why you quote that line in particular, but you do need to
guard against leakage when producing an error.  (And, concerning the
error, what Kent Fredric says about allowing completely empty lines
makes sense.)

You will need to free tmpstr and restore the line number before dying
as happens under the 'interminable:' label.  Also, see the comments
preceding the last instance of 'goto interminable' concering refcounts
on linestr_save.  I do not know offhand whether they will apply to
your code (i.e., I am too lazy to think it through).

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