This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add PerlIO_init_table() to initialise PL_perio
authorDavid Mitchell <davem@iabyn.com>
Wed, 17 Nov 2010 16:29:04 +0000 (16:29 +0000)
committerDavid Mitchell <davem@iabyn.com>
Fri, 26 Nov 2010 16:01:34 +0000 (16:01 +0000)
commit8995e67d43b457d0463f0581e10b390bc378c894
tree3ed18b1421df68b44e5483897a7b875b6697ada1
parent16865ff7e97c2532fd2001d68cf18909acb0d838
add PerlIO_init_table() to initialise PL_perio

Previously, the PL_perio table was initialised by calling PerlIO_allocate,
and throwing away the result. Since a slot with a null ->next was regarded
as freed, the next call to PerlIO_allocate would reuse that slot, which is
important, as STDIN etc are expected to occupy slots 1,2,3.

Once reference counting of the slots is introduced, however, the first
slot will leak, and STDIN etc will be assigned to the wrong slots. So do it
properly now.
perlio.c