DB_File 1.810
[p5sagit/p5-mst-13.2.git] / mg.c
diff --git a/mg.c b/mg.c
index 4ab7f4f..ee705ad 100644 (file)
--- a/mg.c
+++ b/mg.c
 
 /*
 =head1 Magical Functions
+
+"Magic" is special data attached to SV structures in order to give them
+"magical" properties.  When any Perl code tries to read from, or assign to,
+an SV marked as magical, it calls the 'get' or 'set' function associated
+with that SV's magic. A get is called prior to reading an SV, in order to
+give it a chance to update its internal value (get on $. writes the line
+number of the last read filehandle into to the SV's IV slot), while
+set is called after an SV has been written to, in order to allow it to make
+use of its changed value (set on $/ copies the SV's new value to the
+PL_rs global variable).
+
+Magic is implemented as a linked list of MAGIC structures attached to the
+SV. Each MAGIC struct holds the type of the magic, a pointer to an array
+of functions that implement the get(), set(), length() etc functions,
+plus space for some flags and pointers. For example, a tied variable has
+a MAGIC structure that contains a pointer to the object associated with the
+tie.
+
 */
 
 #include "EXTERN.h"
@@ -190,7 +208,7 @@ Perl_mg_get(pTHX_ SV *sv)
     if (SvREFCNT(sv) == 1) {
        /* We hold the last reference to this SV, which implies that the
           SV was deleted as a side effect of the routines we called.  */
-       SvOK_off(sv);
+       (void)SvOK_off(sv);
     }
     return 0;
 }
@@ -2529,8 +2547,6 @@ Perl_sighandler(int sig)
        flags |= 1;
     if (PL_markstack_ptr < PL_markstack_max - 2)
        flags |= 4;
-    if (PL_retstack_ix < PL_retstack_max - 2)
-       flags |= 8;
     if (PL_scopestack_ix < PL_scopestack_max - 3)
        flags |= 16;
 
@@ -2548,10 +2564,6 @@ Perl_sighandler(int sig)
     }
     if (flags & 4)
        PL_markstack_ptr++;             /* Protect mark. */
-    if (flags & 8) {
-       PL_retstack_ix++;
-       PL_retstack[PL_retstack_ix] = NULL;
-    }
     if (flags & 16)
        PL_scopestack_ix += 1;
     /* sv_2cv is too complicated, try a simpler variant first: */
@@ -2612,8 +2624,6 @@ cleanup:
        PL_savestack_ix -= 8; /* Unprotect save in progress. */
     if (flags & 4)
        PL_markstack_ptr--;
-    if (flags & 8)
-       PL_retstack_ix--;
     if (flags & 16)
        PL_scopestack_ix -= 1;
     if (flags & 64)