This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Move freeing the old body after the creating of the new body.
[perl5.git] / minimod.pl
index 2300a7f..39f9763 100644 (file)
@@ -40,7 +40,7 @@ $tail=<<'EOF!TAIL';
 END
 
 while (<MINI>) {
-    print;
+    print unless /dXSUB_SYS/;
 }
 close MINI;
 
@@ -59,13 +59,15 @@ sub writemain{
        my($mname, $cname);
        ($mname = $pname) =~ s!/!::!g;
        ($cname = $pname) =~ s!/!__!g;
-       print "EXTERN_C void boot_${cname} _((CV* cv));\n";
+        print "EXTERN_C void boot_${cname} (pTHX_ CV* cv);\n";
     }
 
     my ($tail1,$tail2) = ( $tail =~ /\A(.*\n)(\s*\}.*)\Z/s );
     print $tail1;
 
-    print "    char *file = __FILE__;\n";
+    print "\tconst char file[] = __FILE__;\n";
+    print "\tdXSUB_SYS;\n" if $] > 5.002;
+
     foreach $_ (@exts){
        my($pname) = canon('/', $_);
        my($mname, $cname, $ccode);
@@ -101,9 +103,10 @@ sub canon{
 
 1;
 __END__
+
 =head1 NAME
 
-ExtUtils::Miniperl.PL
+ExtUtils::Miniperl, writemain - write the C code for perlmain.c
 
 =head1 SYNOPSIS