diff options
author | Daniel Dragan <bulk88@hotmail.com> | 2012-11-12 03:22:12 -0500 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-11-12 11:18:06 -0800 |
commit | 2bcd6579c4ef6796b83fd758613f3e686e7418a7 (patch) | |
tree | 131796e763607842ffa747b38fa6b9e2a5525d1a /perlio.c | |
parent | fa3febb6e5b7a5e436c9b0a4104a1bc22803bc49 (diff) | |
download | perl-2bcd6579c4ef6796b83fd758613f3e686e7418a7.tar.gz |
more dTHX optimizations
Either delay fetching of the context, or move the declaration close to the
first usage point, or remove the dependency on a context.
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -466,7 +466,6 @@ PerlIO_debug(const char *fmt, ...) } } if (PL_perlio_debug_fd > 0) { - dTHX; #ifdef USE_ITHREADS const char * const s = CopFILE(PL_curcop); /* Use fixed buffer as sv_catpvf etc. needs SVs */ @@ -2392,7 +2391,6 @@ PerlIOUnix_refcnt_inc(int fd) int PerlIOUnix_refcnt_dec(int fd) { - dTHX; int cnt = 0; if (fd >= 0) { dVAR; @@ -2401,12 +2399,12 @@ PerlIOUnix_refcnt_dec(int fd) #endif if (fd >= PL_perlio_fd_refcnt_size) { /* diag_listed_as: refcnt_dec: fd %d%s */ - Perl_croak(aTHX_ "refcnt_dec: fd %d >= refcnt_size %d\n", + Perl_croak_nocontext("refcnt_dec: fd %d >= refcnt_size %d\n", fd, PL_perlio_fd_refcnt_size); } if (PL_perlio_fd_refcnt[fd] <= 0) { /* diag_listed_as: refcnt_dec: fd %d%s */ - Perl_croak(aTHX_ "refcnt_dec: fd %d: %d <= 0\n", + Perl_croak_nocontext("refcnt_dec: fd %d: %d <= 0\n", fd, PL_perlio_fd_refcnt[fd]); } cnt = --PL_perlio_fd_refcnt[fd]; @@ -2416,7 +2414,7 @@ PerlIOUnix_refcnt_dec(int fd) #endif } else { /* diag_listed_as: refcnt_dec: fd %d%s */ - Perl_croak(aTHX_ "refcnt_dec: fd %d < 0\n", fd); + Perl_croak_nocontext("refcnt_dec: fd %d < 0\n", fd); } return cnt; } @@ -3790,12 +3788,14 @@ PerlIO_releaseFILE(PerlIO *p, FILE *f) while ((l = *p)) { if (l->tab == &PerlIO_stdio) { PerlIOStdio *s = PerlIOSelf(&l, PerlIOStdio); - if (s->stdio == f) { - dTHX; + if (s->stdio == f) { /* not in a loop */ const int fd = fileno(f); if (fd >= 0) PerlIOUnix_refcnt_dec(fd); - PerlIO_pop(aTHX_ p); + { + dTHX; + PerlIO_pop(aTHX_ p); + } return; } } @@ -5093,9 +5093,9 @@ Perl_PerlIO_context_layers(pTHX_ const char *mode) int PerlIO_setpos(PerlIO *f, SV *pos) { - dTHX; if (SvOK(pos)) { STRLEN len; + dTHX; const Off_t * const posn = (Off_t *) SvPV(pos, len); if (f && len == sizeof(Off_t)) return PerlIO_seek(f, *posn, SEEK_SET); |