X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=perlio.c;h=8a93acbd6ad6a24aeda3e92931e3fed01b31267d;hb=1242dfaee525d4d0ab20ac8ae62b3f0de03fa88e;hp=47fbd92321a610b65f7878a8e6d3ea1b2d705630;hpb=ec6fa4f0cdba2fa84d6f1ede5d2c07f929d400f6;p=p5sagit%2Fp5-mst-13.2.git diff --git a/perlio.c b/perlio.c index 47fbd92..8a93acb 100644 --- a/perlio.c +++ b/perlio.c @@ -2864,7 +2864,6 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers, #endif stdio = PerlSIO_fopen(path, mode); if (stdio) { - PerlIOStdio *s; if (!f) { f = PerlIO_allocate(aTHX); } @@ -2872,9 +2871,10 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers, mode = PerlIOStdio_mode(mode, tmode); f = PerlIO_push(aTHX_ f, self, mode, PerlIOArg); if (f) { - s = PerlIOSelf(f, PerlIOStdio); - s->stdio = stdio; - PerlIOUnix_refcnt_inc(fileno(s->stdio)); + PerlIOSelf(f, PerlIOStdio)->stdio = stdio; + PerlIOUnix_refcnt_inc(fileno(stdio)); + } else { + PerlSIO_fclose(stdio); } return f; } @@ -2912,9 +2912,8 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers, f = PerlIO_allocate(aTHX); } if ((f = PerlIO_push(aTHX_ f, self, mode, PerlIOArg))) { - PerlIOStdio * const s = PerlIOSelf(f, PerlIOStdio); - s->stdio = stdio; - PerlIOUnix_refcnt_inc(fileno(s->stdio)); + PerlIOSelf(f, PerlIOStdio)->stdio = stdio; + PerlIOUnix_refcnt_inc(fileno(stdio)); } return f; } @@ -3709,7 +3708,7 @@ PerlIOBuf_fill(pTHX_ PerlIO *f) if (!b->buf) PerlIO_get_base(f); /* allocate via vtable */ - assert(b->buf); + assert(b->buf); /* The b->buf does get allocated via the vtable system. */ b->ptr = b->end = b->buf;