diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-03-23 16:27:41 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-03-23 16:27:41 +0000 |
commit | 1141d9f89ca1cb89e46951e8afc784c7b4862cd2 (patch) | |
tree | 29e556aabb356fad800a7434cc402c39bb8333aa /doio.c | |
parent | a999f61be32148694ba1c2837b1a303e42fd96b1 (diff) | |
download | perl-1141d9f89ca1cb89e46951e8afc784c7b4862cd2.tar.gz |
Check in a stable (working) version before next round of tweaks.
Changes include:
- Move default layers code out of doio.c and into perlio.c
- Single routine for parsing layer specification strings.
- Skeleton support for demand loading of layers
- Core-dump avoidance if PERLIO environment specifies loadable layer
(does not _work_ as need IO to load and need load to do IO ...)
p4raw-id: //depot/perlio@9313
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 35 |
1 files changed, 7 insertions, 28 deletions
@@ -68,28 +68,6 @@ Perl_do_open9(pTHX_ GV *gv, register char *name, I32 len, int as_raw, supplied_fp, &svs, 1); } -static char *S_layers(pTHX_ char *mode); - -static char * -S_layers(pTHX_ char *mode) -{ - char *type = NULL; - /* Need to supply default layer info from open.pm */ - SV *layers = PL_curcop->cop_io; - if (layers) { - STRLEN len; - type = SvPV(layers,len); - if (type && mode[0] != 'r') { - /* Skip to write part */ - char *s = strchr(type,0); - if (s && (s-type) < len) { - type = s+1; - } - } - } - return type; -} - bool Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawperm, PerlIO *supplied_fp, SV **svp, @@ -214,7 +192,8 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, namesv = sv_2mortal(newSVpvn(name,strlen(name))); num_svs = 1; svp = &namesv; - fp = PerlIO_openn(aTHX_ S_layers(aTHX_ mode),mode, -1, rawmode, rawperm, NULL, num_svs, svp); + type = Nullch; + fp = PerlIO_openn(aTHX_ type,mode, -1, rawmode, rawperm, NULL, num_svs, svp); } else { /* Regular (non-sys) open */ @@ -391,7 +370,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, else was_fdopen = TRUE; if (!num_svs) - type = S_layers(aTHX_ mode); + type = Nullch; if (!(fp = PerlIO_openn(aTHX_ type,mode,fd,0,0,NULL,num_svs,svp))) { if (dodup) PerlLIO_close(fd); @@ -415,7 +394,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, namesv = sv_2mortal(newSVpvn(type,strlen(type))); num_svs = 1; svp = &namesv; - type = S_layers(aTHX_ mode); + type = Nullch; } fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp); } @@ -447,7 +426,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, namesv = sv_2mortal(newSVpvn(type,strlen(type))); num_svs = 1; svp = &namesv; - type = S_layers(aTHX_ mode); + type = Nullch; } fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp); } @@ -510,7 +489,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, namesv = sv_2mortal(newSVpvn(type,strlen(type))); num_svs = 1; svp = &namesv; - type = S_layers(aTHX_ mode); + type = Nullch; } fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp); } @@ -614,7 +593,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, if (IoTYPE(io) == IoTYPE_SOCKET || (IoTYPE(io) == IoTYPE_WRONLY && S_ISCHR(PL_statbuf.st_mode)) ) { mode[0] = 'w'; - if (!(IoOFP(io) = PerlIO_openn(aTHX_ S_layers(aTHX_ mode),mode,PerlIO_fileno(fp),0,0,NULL,num_svs,svp))) { + if (!(IoOFP(io) = PerlIO_openn(aTHX_ type,mode,PerlIO_fileno(fp),0,0,NULL,num_svs,svp))) { PerlIO_close(fp); IoIFP(io) = Nullfp; goto say_false; |