summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-12 16:06:20 +0100
committerNicholas Clark <nick@ccl4.org>2009-10-12 16:06:20 +0100
commita2a5de9516c1b256b060768ac6dad252a3aa3be7 (patch)
treeaeb1473ea930984671f646814f6a7a7802164960 /perlio.c
parent5f5991a0d6d8ef99d2643b88a7d9285e35277331 (diff)
downloadperl-a2a5de9516c1b256b060768ac6dad252a3aa3be7.tar.gz
Add Perl_ck_warner(), which combines Perl_ckwarn() and Perl_warner().
Replace ckWARN{,2,3,4}() && Perl_warner() with it, which trades reduced code size (about 0.2%), for 1 more function call if warnings are not enabled. However, if we're now in the L1 or L2 cache when we weren't previously, that's still going to be a speed win.
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/perlio.c b/perlio.c
index 50966e6b09..36bf0ac05f 100644
--- a/perlio.c
+++ b/perlio.c
@@ -981,10 +981,9 @@ PerlIO_parse_layers(pTHX_ PerlIO_list_t *av, const char *names)
* seen as an invalid separator character.
*/
const char q = ((*s == '\'') ? '"' : '\'');
- if (ckWARN(WARN_LAYER))
- Perl_warner(aTHX_ packWARN(WARN_LAYER),
- "Invalid separator character %c%c%c in PerlIO layer specification %s",
- q, *s, q, s);
+ Perl_ck_warner(aTHX_ packWARN(WARN_LAYER),
+ "Invalid separator character %c%c%c in PerlIO layer specification %s",
+ q, *s, q, s);
SETERRNO(EINVAL, LIB_INVARG);
return -1;
}
@@ -1018,10 +1017,9 @@ PerlIO_parse_layers(pTHX_ PerlIO_list_t *av, const char *names)
*/
case '\0':
e--;
- if (ckWARN(WARN_LAYER))
- Perl_warner(aTHX_ packWARN(WARN_LAYER),
- "Argument list not closed for PerlIO layer \"%.*s\"",
- (int) (e - s), s);
+ Perl_ck_warner(aTHX_ packWARN(WARN_LAYER),
+ "Argument list not closed for PerlIO layer \"%.*s\"",
+ (int) (e - s), s);
return -1;
default:
/*
@@ -1044,9 +1042,8 @@ PerlIO_parse_layers(pTHX_ PerlIO_list_t *av, const char *names)
SvREFCNT_dec(arg);
}
else {
- if (ckWARN(WARN_LAYER))
- Perl_warner(aTHX_ packWARN(WARN_LAYER), "Unknown PerlIO layer \"%.*s\"",
- (int) llen, s);
+ Perl_ck_warner(aTHX_ packWARN(WARN_LAYER), "Unknown PerlIO layer \"%.*s\"",
+ (int) llen, s);
return -1;
}
}
@@ -1460,8 +1457,8 @@ PerlIO_layer_from_ref(pTHX_ SV *sv)
PerlIO_funcs *f = PerlIO_find_layer(aTHX_ STR_WITH_LEN("scalar"), 1);
/* This isn't supposed to happen, since PerlIO::scalar is core,
* but could happen anyway in smaller installs or with PAR */
- if (!f && ckWARN(WARN_LAYER))
- Perl_warner(aTHX_ packWARN(WARN_LAYER), "Unknown PerlIO layer \"scalar\"");
+ if (!f)
+ Perl_ck_warner(aTHX_ packWARN(WARN_LAYER), "Unknown PerlIO layer \"scalar\"");
return f;
}