#endif
stdio = PerlSIO_fopen(path, mode);
if (stdio) {
- PerlIOStdio *s;
if (!f) {
f = PerlIO_allocate(aTHX);
}
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;
}
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;
}
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;