summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-13 11:41:36 +0100
committerNicholas Clark <nick@ccl4.org>2009-10-13 11:41:36 +0100
commit26c7b074d5d3f0a79fab5f1c4eb28f38e81b88d2 (patch)
tree7c097647e44e1b39f6ae15c9c9d15f3673e478d9 /util.c
parentad287e37d27b33d67ab22c0c8a7294f1eb467342 (diff)
downloadperl-26c7b074d5d3f0a79fab5f1c4eb28f38e81b88d2.tar.gz
Migrate common code in Perl_ckwarn() and Perl_ckwarn_d() to S_ckwarn_common()
Diffstat (limited to 'util.c')
-rw-r--r--util.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/util.c b/util.c
index dc1a26f329..13b56a0802 100644
--- a/util.c
+++ b/util.c
@@ -1602,21 +1602,7 @@ Perl_ckwarn(pTHX_ U32 w)
if (isLEXWARN_off)
return PL_dowarn & G_WARN_ON;
- if (PL_curcop->cop_warnings == pWARN_ALL)
- return TRUE;
-
- if (PL_curcop->cop_warnings == pWARN_NONE)
- return FALSE;
-
- /* Right, dealt with all the special cases, which are implemented as non-
- pointers, so there is a pointer to a real warnings mask. */
- return isWARN_on(PL_curcop->cop_warnings, unpackWARN1(w))
- || (unpackWARN2(w) &&
- isWARN_on(PL_curcop->cop_warnings, unpackWARN2(w)))
- || (unpackWARN3(w) &&
- isWARN_on(PL_curcop->cop_warnings, unpackWARN3(w)))
- || (unpackWARN4(w) &&
- isWARN_on(PL_curcop->cop_warnings, unpackWARN4(w)));
+ return ckwarn_common(w);
}
/* implements the ckWARN?_d macro */
@@ -1629,12 +1615,20 @@ Perl_ckwarn_d(pTHX_ U32 w)
if (isLEXWARN_off)
return TRUE;
+ return ckwarn_common(w);
+}
+
+static bool
+S_ckwarn_common(pTHX_ U32 w)
+{
if (PL_curcop->cop_warnings == pWARN_ALL)
return TRUE;
if (PL_curcop->cop_warnings == pWARN_NONE)
return FALSE;
+ /* Right, dealt with all the special cases, which are implemented as non-
+ pointers, so there is a pointer to a real warnings mask. */
return isWARN_on(PL_curcop->cop_warnings, unpackWARN1(w))
|| (unpackWARN2(w) &&
isWARN_on(PL_curcop->cop_warnings, unpackWARN2(w)))