This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
[perl5.git] / sv.h
diff --git a/sv.h b/sv.h
index 69cbb34..ab73796 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -801,6 +801,18 @@ and leaves the UTF-8 status as it was.
        STMT_START { assert(SvTYPE(sv) >= SVt_PV); \
                (SvCUR(sv) = (val) - SvPVX(sv)); } STMT_END
 
+#define SvPV_free(sv) \
+       STMT_START { assert(SvTYPE(sv) >= SVt_PV);      \
+               if (SvLEN(sv)) {                        \
+                   if(SvOOK(sv)) {                     \
+                     Safefree(SvPVX(sv) - SvIVX(sv));  \
+                     SvFLAGS(sv) &= ~SVf_OOK;          \
+                   } else {                            \
+                     Safefree(SvPVX(sv));              \
+                   }                                   \
+               }                                       \
+       } STMT_END
+
 #define BmRARE(sv)     ((XPVBM*)  SvANY(sv))->xbm_rare
 #define BmUSEFUL(sv)   ((XPVBM*)  SvANY(sv))->xbm_useful
 #define BmPREVIOUS(sv) ((XPVBM*)  SvANY(sv))->xbm_previous