summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-05-31 16:56:00 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-06-02 08:15:27 -0400
commitb469f1e0fc5f0ac882161e627a1255ee11e67c37 (patch)
treeea5f4b46c4b6fbe58ded80930b2f5d0aae02d3d0 /perlio.c
parent0c2c57a86cc6ec5688af5df66a8b8929f97ac491 (diff)
downloadperl-b469f1e0fc5f0ac882161e627a1255ee11e67c37.tar.gz
Use PERL_UNUSED_RESULT.
(1) Enhance its description. (2) Simplify it: define only if has warn_unused_result. (3) Make it use STMT_START { ... } STMT_END to be less GNU-extensiony. (4) Redo 04783dc7 ("fix 'ignoring return value' compiler warnings") with it.
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/perlio.c b/perlio.c
index 29c4bf771e..c4ace6876d 100644
--- a/perlio.c
+++ b/perlio.c
@@ -389,14 +389,13 @@ PerlIO_debug(const char *fmt, ...)
}
}
if (PL_perlio_debug_fd > 0) {
- int rc = 0;
#ifdef USE_ITHREADS
const char * const s = CopFILE(PL_curcop);
/* Use fixed buffer as sv_catpvf etc. needs SVs */
char buffer[1024];
const STRLEN len1 = my_snprintf(buffer, sizeof(buffer), "%.40s:%" IVdf " ", s ? s : "(none)", (IV) CopLINE(PL_curcop));
const STRLEN len2 = my_vsnprintf(buffer + len1, sizeof(buffer) - len1, fmt, ap);
- rc = PerlLIO_write(PL_perlio_debug_fd, buffer, len1 + len2);
+ PERL_UNUSED_RESULT(PerlLIO_write(PL_perlio_debug_fd, buffer, len1 + len2));
#else
const char *s = CopFILE(PL_curcop);
STRLEN len;
@@ -405,11 +404,9 @@ PerlIO_debug(const char *fmt, ...)
Perl_sv_vcatpvf(aTHX_ sv, fmt, &ap);
s = SvPV_const(sv, len);
- rc = PerlLIO_write(PL_perlio_debug_fd, s, len);
+ PERL_UNUSED_RESULT(PerlLIO_write(PL_perlio_debug_fd, s, len));
SvREFCNT_dec(sv);
#endif
- /* silently ignore failures */
- PERL_UNUSED_VAR(rc);
}
va_end(ap);
}