diff options
author | Nicolas R <atoomic@cpan.org> | 2020-03-10 11:14:04 -0600 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2020-03-16 10:37:17 +1100 |
commit | 94c8b9c1f0f31f0e85c11a61ad166ea156ae2b3a (patch) | |
tree | fb8784fec659db0d521401acd43a18580870cffb /perl.c | |
parent | 7c1815b7942f8c7e3651d98060ca7a0760e6483c (diff) | |
download | perl-94c8b9c1f0f31f0e85c11a61ad166ea156ae2b3a.tar.gz |
Add macro to free and set cop_warnings
This is avoiding the boilerplate to free
the cop_warning string when setting it.
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -1245,9 +1245,7 @@ perl_destruct(pTHXx) } } - if (!specialWARN(PL_compiling.cop_warnings)) - PerlMemShared_free(PL_compiling.cop_warnings); - PL_compiling.cop_warnings = NULL; + free_and_set_cop_warnings(PL_compiling, NULL); cophh_free(CopHINTHASH_get(&PL_compiling)); CopHINTHASH_set(&PL_compiling, cophh_new_empty()); CopFILE_free(&PL_compiling); @@ -3740,16 +3738,12 @@ Perl_moreswitches(pTHX_ const char *s) return s; case 'W': PL_dowarn = G_WARN_ALL_ON|G_WARN_ON; - if (!specialWARN(PL_compiling.cop_warnings)) - PerlMemShared_free(PL_compiling.cop_warnings); - PL_compiling.cop_warnings = pWARN_ALL ; + free_and_set_cop_warnings(PL_compiling, pWARN_ALL); s++; return s; case 'X': PL_dowarn = G_WARN_ALL_OFF; - if (!specialWARN(PL_compiling.cop_warnings)) - PerlMemShared_free(PL_compiling.cop_warnings); - PL_compiling.cop_warnings = pWARN_NONE ; + free_and_set_cop_warnings(PL_compiling, pWARN_NONE); s++; return s; case '*': |