This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add a usage note about the "l" modifier.
[perl5.git] / mg.c
diff --git a/mg.c b/mg.c
index d14b2eb..8b90aa4 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -842,7 +842,7 @@ S_fixup_errno_string(pTHX_ SV* sv)
 }
 
 /*
-=for apidoc_section Errno
+=for apidoc_section $errno
 =for apidoc sv_string_from_errnum
 
 Generates the message string describing an OS error and returns it as
@@ -1906,7 +1906,7 @@ Perl_magic_setnkeys(pTHX_ SV *sv, MAGIC *mg)
 }
 
 /*
-=for apidoc_section Magic
+=for apidoc_section $magic
 =for apidoc magic_methcall
 
 Invoke a magic method (like FETCH).
@@ -2669,9 +2669,12 @@ Perl_magic_freecollxfrm(pTHX_ SV *sv, MAGIC *mg)
     /* Collate magic uses mg_len as a string length rather than a buffer
      * length, so we need to free even with mg_len == 0: hence we can't
      * rely on standard magic free handling */
-    assert(mg->mg_type == PERL_MAGIC_collxfrm && mg->mg_len >= 0);
-    Safefree(mg->mg_ptr);
-    mg->mg_ptr = NULL;
+    if (mg->mg_len >= 0) {
+        assert(mg->mg_type == PERL_MAGIC_collxfrm);
+        Safefree(mg->mg_ptr);
+        mg->mg_ptr = NULL;
+    }
+
     return 0;
 }
 #endif /* USE_LOCALE_COLLATE */
@@ -3350,7 +3353,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
 }
 
 /*
-=for apidoc_section Signals
+=for apidoc_section $signals
 =for apidoc whichsig
 =for apidoc_item whichsig_pv
 =for apidoc_item whichsig_pvn
@@ -3710,7 +3713,7 @@ S_unwind_handler_stack(pTHX_ const void *p)
 }
 
 /*
-=for apidoc_section Magic
+=for apidoc_section $magic
 =for apidoc magic_sethint
 
 Triggered by a store to C<%^H>, records the key/value pair to