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

[perl #121159] List form of pipe open not implemented on Win32

From:
Tony Cook via RT
Date:
October 1, 2014 06:42
Subject:
[perl #121159] List form of pipe open not implemented on Win32
Message ID:
rt-4.0.18-30001-1412145756-905.121159-15-0@perl.org
On Thu Aug 28 15:09:34 2014, bulk88 wrote:
> On Mon Aug 18 23:05:20 2014, tonyc wrote:
> >
> > Patch attached for picking apart.
> >
> > Tony
> 
> win32_popen returns a PerlIO*, which is wrong since win32_* are C lib
> level replacements, not general perl api. If something. It should be
> called Perl_do_popen, and remove win32_popen.

win32_popen() emulates the Unix popen(), and since we're in perl land, it returns a PerlIO * instead of a FILE * (it used to return FILE *).

> +                   Move(args_pvs, args_pvs+w32_perlshell_items,
> narg+1, const char *);
> +                   for (i = 0; i < w32_perlshell_items; ++i)
> +                       args_pvs[i] = w32_perlshell_vec[i];
> 
> Why is 1 a Move and the other is a for loop? How about alloca instead
> of the Newx?

Good point on the for loop, I've changed it to a Copy().

Your mention of alloca() did get me thinking - the SvPV_nolen(args[i]) calls can croak, which would leak memory.  I've removed the Safefree(args_pvs) calls and added SAVEFREEPV(args_pvs) instead.

Tony


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=121159



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