From: Vincent Pit <vince@profvince.com>
Date: Thu, 20 Sep 2012 19:18:44 +0000 (+0200)
Subject: Reformat the section of context_info() that extracts the warnings
X-Git-Tag: v0.21~5
X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=59cd3cf482c2e582db5f5d41ff4730069bdea583;p=perl%2Fmodules%2FScope-Upper.git

Reformat the section of context_info() that extracts the warnings

This will ease up future alterations to this code.
---

diff --git a/Upper.xs b/Upper.xs
index ca702be..308bb7c 100644
--- a/Upper.xs
+++ b/Upper.xs
@@ -2665,12 +2665,18 @@ PPCODE:
 #else
   SV *old_warnings = cop->cop_warnings;
 #endif
-  if (old_warnings == pWARN_NONE ||
-      (old_warnings == pWARN_STD && (PL_dowarn & G_WARN_ON) == 0)) {
+  if (old_warnings == pWARN_STD) {
+   if (PL_dowarn & G_WARN_ON)
+    goto context_info_warnings_on;
+   else
+    goto context_info_warnings_off;
+  } else if (old_warnings == pWARN_NONE) {
+context_info_warnings_off:
    mask = su_newmortal_pvn(WARN_NONEstring, WARNsize);
-  } else if (old_warnings == pWARN_ALL ||
-             (old_warnings == pWARN_STD && PL_dowarn & G_WARN_ON)) {
-   HV *bits = get_hv("warnings::Bits", 0);
+  } else if (old_warnings == pWARN_ALL) {
+   HV *bits;
+context_info_warnings_on:
+   bits = get_hv("warnings::Bits", 0);
    if (bits) {
     SV **bits_all = hv_fetchs(bits, "all", FALSE);
     if (bits_all)