This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add, improve some debugging stmts for -DL (locales)
authorKarl Williamson <khw@cpan.org>
Thu, 21 Mar 2019 04:58:38 +0000 (22:58 -0600)
committerKarl Williamson <khw@cpan.org>
Thu, 21 Mar 2019 16:50:01 +0000 (10:50 -0600)
locale.c
perl.c

index 2b123d1..71cf1a3 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -1048,7 +1048,11 @@ S_emulate_setlocale(const int category,
 #  ifdef DEBUGGING
 
     if (DEBUG_Lv_TEST || debug_initialization) {
-        PerlIO_printf(Perl_debug_log, "%s:%d: emulate_setlocale created %p; should have freed %p\n", __FILE__, __LINE__, new_obj, old_obj);
+        PerlIO_printf(Perl_debug_log, "%s:%d: emulate_setlocale created %p", __FILE__, __LINE__, new_obj);
+        if (old_obj) {
+            PerlIO_printf(Perl_debug_log, "; should have freed %p", old_obj);
+        }
+        PerlIO_printf(Perl_debug_log, "\n");
     }
 
 #  endif
diff --git a/perl.c b/perl.c
index 3c49f96..cdefa99 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -1139,11 +1139,16 @@ perl_destruct(pTHXx)
          * below */
         const locale_t old_locale = uselocale(LC_GLOBAL_LOCALE);
         if (old_locale != LC_GLOBAL_LOCALE) {
+            DEBUG_Lv(PerlIO_printf(Perl_debug_log,
+                     "%s:%d: Freeing %p\n", __FILE__, __LINE__, old_locale));
             freelocale(old_locale);
         }
     }
 #  ifdef USE_LOCALE_NUMERIC
     if (PL_underlying_numeric_obj) {
+        DEBUG_Lv(PerlIO_printf(Perl_debug_log,
+                    "%s:%d: Freeing %p\n", __FILE__, __LINE__,
+                    PL_underlying_numeric_obj));
         freelocale(PL_underlying_numeric_obj);
         PL_underlying_numeric_obj = (locale_t) NULL;
     }