This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
slightly smarter make_patchnum logic, detect if there are changes to the working...
[perl5.git] / mathoms.c
index 9761488..7eae87e 100644 (file)
--- a/mathoms.c
+++ b/mathoms.c
@@ -8,13 +8,15 @@
  */
 
 /*
- * "Anything that Hobbits had no immediate use for, but were unwilling to 
- * throw away, they called a mathom. Their dwellings were apt to become
- * rather crowded with mathoms, and many of the presents that passed from
- * hand to hand were of that sort." 
+ *  Anything that Hobbits had no immediate use for, but were unwilling to
+ *  throw away, they called a mathom.  Their dwellings were apt to become
+ *  rather crowded with mathoms, and many of the presents that passed from
+ *  hand to hand were of that sort.
+ *
+ *     [p.5 of _The Lord of the Rings_: "Prologue"]
  */
 
-#ifndef NO_MATHOMS
+
 
 /* 
  * This file contains mathoms, various binary artifacts from previous
 #define PERL_IN_MATHOMS_C
 #include "perl.h"
 
+#ifdef NO_MATHOMS
+/* ..." warning: ISO C forbids an empty source file"
+   So make sure we have something in here by processing the headers anyway.
+ */
+#else
+
 PERL_CALLCONV OP * Perl_ref(pTHX_ OP *o, I32 type);
 PERL_CALLCONV void Perl_sv_unref(pTHX_ SV *sv);
 PERL_CALLCONV void Perl_sv_taint(pTHX_ SV *sv);
@@ -602,30 +610,7 @@ Perl_hv_magic(pTHX_ HV *hv, GV *gv, int how)
 {
     PERL_ARGS_ASSERT_HV_MAGIC;
 
-    sv_magic((SV*)hv, (SV*)gv, how, NULL, 0);
-}
-
-AV *
-Perl_av_fake(pTHX_ register I32 size, register SV **strp)
-{
-    register SV** ary;
-    register AV * const av = (AV*)newSV_type(SVt_PVAV);
-
-    PERL_ARGS_ASSERT_AV_FAKE;
-
-    Newx(ary,size+1,SV*);
-    AvALLOC(av) = ary;
-    Copy(strp,ary,size,SV*);
-    AvREIFY_only(av);
-    AvARRAY(av) = ary;
-    AvFILLp(av) = size - 1;
-    AvMAX(av) = size - 1;
-    while (size--) {
-        assert (*strp);
-        SvTEMP_off(*strp);
-        strp++;
-    }
-    return av;
+    sv_magic(MUTABLE_SV(hv), MUTABLE_SV(gv), how, NULL, 0);
 }
 
 bool
@@ -695,17 +680,6 @@ Perl_init_i18nl14n(pTHX_ int printwarn)
     return init_i18nl10n(printwarn);
 }
 
-OP *
-Perl_oopsCV(pTHX_ OP *o)
-{
-    PERL_ARGS_ASSERT_OOPSCV;
-
-    Perl_croak(aTHX_ "NOT IMPL LINE %d",__LINE__);
-    /* STUB */
-    PERL_UNUSED_ARG(o);
-    NORETURN_FUNCTION_END;
-}
-
 PP(pp_padany)
 {
     DIE(aTHX_ "NOT IMPL LINE %d",__LINE__);
@@ -1274,14 +1248,6 @@ Perl_sv_usepvn(pTHX_ SV *sv, char *ptr, STRLEN len)
     sv_usepvn_flags(sv,ptr,len, 0);
 }
 
-void
-Perl_cv_ckproto(pTHX_ const CV *cv, const GV *gv, const char *p)
-{
-    PERL_ARGS_ASSERT_CV_CKPROTO;
-
-    cv_ckproto_len(cv, gv, p, p ? strlen(p) : 0);
-}
-
 /*
 =for apidoc unpack_str
 
@@ -1353,8 +1319,8 @@ Perl_hv_delete_ent(pTHX_ HV *hv, SV *keysv, I32 flags, U32 hash)
 {
     PERL_ARGS_ASSERT_HV_DELETE_ENT;
 
-    return (SV *) hv_common(hv, keysv, NULL, 0, 0, flags | HV_DELETE, NULL,
-                           hash);
+    return MUTABLE_SV(hv_common(hv, keysv, NULL, 0, 0, flags | HV_DELETE, NULL,
+                               hash));
 }
 
 SV**
@@ -1436,8 +1402,8 @@ Perl_hv_delete(pTHX_ HV *hv, const char *key, I32 klen_i32, I32 flags)
        klen = klen_i32;
        k_flags = 0;
     }
-    return (SV *) hv_common(hv, NULL, key, klen, k_flags, flags | HV_DELETE,
-                           NULL, 0);
+    return MUTABLE_SV(hv_common(hv, NULL, key, klen, k_flags, flags | HV_DELETE,
+                               NULL, 0));
 }
 
 /* Functions after here were made mathoms post 5.10.0 but pre 5.8.9 */
@@ -1445,7 +1411,7 @@ Perl_hv_delete(pTHX_ HV *hv, const char *key, I32 klen_i32, I32 flags)
 AV *
 Perl_newAV(pTHX)
 {
-    return (AV*)newSV_type(SVt_PVAV);
+    return MUTABLE_AV(newSV_type(SVt_PVAV));
     /* sv_upgrade does AvREAL_only():
     AvALLOC(av) = 0;
     AvARRAY(av) = NULL;
@@ -1455,7 +1421,7 @@ Perl_newAV(pTHX)
 HV *
 Perl_newHV(pTHX)
 {
-    HV * const hv = (HV*)newSV_type(SVt_PVHV);
+    HV * const hv = MUTABLE_HV(newSV_type(SVt_PVHV));
     assert(!SvOK(hv));
 
     return hv;
@@ -1469,6 +1435,44 @@ Perl_sv_insert(pTHX_ SV *const bigstr, const STRLEN offset, const STRLEN len,
     sv_insert_flags(bigstr, offset, len, little, littlelen, SV_GMAGIC);
 }
 
+void
+Perl_save_freesv(pTHX_ SV *sv)
+{
+    dVAR;
+    save_freesv(sv);
+}
+
+void
+Perl_save_mortalizesv(pTHX_ SV *sv)
+{
+    dVAR;
+
+    PERL_ARGS_ASSERT_SAVE_MORTALIZESV;
+
+    save_mortalizesv(sv);
+}
+
+void
+Perl_save_freeop(pTHX_ OP *o)
+{
+    dVAR;
+    save_freeop(o);
+}
+
+void
+Perl_save_freepv(pTHX_ char *pv)
+{
+    dVAR;
+    save_freepv(pv);
+}
+
+void
+Perl_save_op(pTHX)
+{
+    dVAR;
+    save_op();
+}
+
 #endif /* NO_MATHOMS */
 
 /*