X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=reentr.pl;h=049b06eed1d0dd1a8c0f882e360287b18230a681;hb=b7eceb5b089aac293e431894de6d9597f59eefbb;hp=c100115b2a96bbb966ad8b9e83ed7179c1613489;hpb=f6f0b69b4261c1c8a526a772d6ec556acf2786b6;p=p5sagit%2Fp5-mst-13.2.git diff --git a/reentr.pl b/reentr.pl index c100115..049b06e 100644 --- a/reentr.pl +++ b/reentr.pl @@ -5,6 +5,11 @@ # and optionally also the relevant metaconfig units (-U option). # +BEGIN { + # Get function prototypes + require 'regen_lib.pl'; +} + use strict; use Getopt::Std; my %opts; @@ -35,13 +40,16 @@ my %map = ( # Example #3: S_CBI means type func_r(const char*, char*, int) +safer_unlink 'reentr.h'; die "reentr.h: $!" unless open(H, ">reentr.h"); +binmode H; select H; print <. + */ + +#ifndef PERL_REENTR_API +# if defined(PERL_CORE) || defined(PERL_EXT) +# define PERL_REENTR_API 1 +# else +# define PERL_REENTR_API 0 +# endif +#endif #ifdef USE_REENTRANT_API @@ -59,7 +82,8 @@ print <) { # Read in the protypes. # If given the -U option open up the metaconfig unit for this function. if ($opts{U} && open(U, ">d_${func}_r.U")) { + binmode U; select U; } @@ -329,7 +365,7 @@ sub pushssif { sub pushinitfree { my $func = shift; push @init, <_${func}_buffer, PL_reentrant_buffer->_${func}_size, char); + Newx(PL_reentrant_buffer->_${func}_buffer, PL_reentrant_buffer->_${func}_size, char); EOF push @free, <_${func}_buffer); @@ -527,7 +563,7 @@ EOF push @size, <$sz = sysconf($sc); - if (PL_reentrant_buffer->$sz == -1) + if (PL_reentrant_buffer->$sz == (size_t) -1) PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE; # else # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ) @@ -577,7 +613,7 @@ EOF EOF push @init, <_${genfunc}_buffer, PL_reentrant_buffer->_${genfunc}_size, char); + Newx(PL_reentrant_buffer->_${genfunc}_buffer, PL_reentrant_buffer->_${genfunc}_size, char); #endif EOF push @free, <_' . $genfunc . '_data)),'; + } push @wrap, <reentr.c"); +binmode C; select C; print <