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 /intrpvar.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 'intrpvar.h')
-rw-r--r-- | intrpvar.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/intrpvar.h b/intrpvar.h index d10feec23e..0c90a9f7a1 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -658,7 +658,7 @@ PERLVAR(Icustom_op_names, HV*) /* Names of user defined ops */ PERLVAR(Icustom_op_descs, HV*) /* Descriptions of user defined ops */ #ifdef PERLIO_LAYERS -PERLVARI(Iperlio, PerlIO *,NULL) +PERLVARI(Iperlio, PerlIOl *,NULL) PERLVARI(Iknown_layers, PerlIO_list_t *,NULL) PERLVARI(Idef_layerlist, PerlIO_list_t *,NULL) #endif |