diff options
author | David Mitchell <davem@iabyn.com> | 2010-11-15 17:06:37 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2010-11-26 16:01:33 +0000 |
commit | 303f2dc3d5bda8ee962db318dd53acb167c07485 (patch) | |
tree | 68a6126a6960890a270e1323a393ae9e96984d1a /perliol.h | |
parent | 507a68aa3c321b422f95b772611c878ce13952df (diff) | |
download | perl-303f2dc3d5bda8ee962db318dd53acb167c07485.tar.gz |
make PL_perlio an array of PerlIOl, not PerlIO *
Layers in PerlIO are implemented as a linked list of PerlIOl structs;
eaxch one has a 'next' field pointing to the next layer. Now here's the
clever bit: When PerlIO* pointers are passed around to refer to a
particular handle, these are actually pointers to the 'next' field of the
*parent* layer (so to access the flags field say of a PerlIOl, you have to
double-defref it, e.g. (*f)->flags). The big advantage of this is that
it's easy for a layer to pop itself; when you call PerlIO_pop(f), f is a
pointer to the parent's 'next' field, so pop(f) can just do
*f = (*f)->next.
This means that there has to be a fake 'next' field above the topmost
layer. This is where PL_perlio comes in: it's a pointer to an arena of
arrays of pointers, each one capable of pointing to a PerlIOl structure.
When a new handle is created, a spare arena slot is grabbed, and the
address of that slot is returned. This also allows for a handle with no
layers.
What this commit does is change PL_perlio from being an array of
PerlIO* into an array of PerlIOl structures - i.e. each element in the
array goes from being a single pointer, to having several fields. These
will be made used of in follow-up commits.
Diffstat (limited to 'perliol.h')
-rw-r--r-- | perliol.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -150,7 +150,7 @@ PERL_EXPORT_C PerlIO_funcs *PerlIO_layer_fetch(pTHX_ PerlIO_list_t *av, IV n, Pe PERL_EXPORT_C SV *PerlIO_sv_dup(pTHX_ SV *arg, CLONE_PARAMS *param); -PERL_EXPORT_C void PerlIO_cleantable(pTHX_ PerlIO **tablep); +PERL_EXPORT_C void PerlIO_cleantable(pTHX_ PerlIOl **tablep); PERL_EXPORT_C SV * PerlIO_tab_sv(pTHX_ PerlIO_funcs *tab); PERL_EXPORT_C void PerlIO_default_buffer(pTHX_ PerlIO_list_t *av); PERL_EXPORT_C void PerlIO_stdstreams(pTHX); |