This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add new test file to MANIFEST. Fix tests for threaded builds.
[perl5.git] / ext / XS / Typemap / Typemap.xs
index b97a9bf..dbb1733 100644 (file)
@@ -48,7 +48,7 @@ static intOpq xst_anintopq;
 /* T_ARRAY - allocate some memory */
 intArray * intArrayPtr( int nelem ) {
     intArray * array;
-    New(0, array, nelem, intArray);
+    Newx(array, nelem, intArray);
     return array;
 }
 
@@ -120,7 +120,7 @@ T_AVREF( av )
 =item T_HVREF
 
 From the perl level this is a reference to a perl hash.
-From the C level this is a pointer to a HV.
+From the C level this is a pointer to an HV.
 
 =cut
 
@@ -201,7 +201,7 @@ T_UV( uv )
 =item T_IV
 
 A signed integer. This is cast to the required  integer type when
-passed to C and converted to a IV when passed back to Perl.
+passed to C and converted to an IV when passed back to Perl.
 
 =cut
 
@@ -764,7 +764,7 @@ the subtype.
 
 intArray *
 T_ARRAY( dummy, array, ... )
-  int dummy = NO_INIT
+  int dummy = 0;
   intArray * array
  PREINIT:
   U32 size_RETVAL;
@@ -795,9 +795,17 @@ T_STDIO_open( file )
   RETVAL
 
 SysRet
-T_STDIO_close( stream )
-  FILE * stream
- CODE:
+T_STDIO_close( f )
+  PerlIO * f
+ PREINIT:
+  FILE * stream;
+ CODE:
+  /* Get the FILE* */
+  stream = PerlIO_findFILE( f );  
+  /* Release the FILE* from the PerlIO system so that we do
+     not close the file twice */
+  PerlIO_releaseFILE(f,stream);
+  /* Must release the file before closing it */
   RETVAL = xsfclose( stream );
  OUTPUT:
   RETVAL