X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=reentr.pl;h=2fb9ff0609c16d7a89c5ea5185f451a3d1fbe437;hb=3e2a970dfeb55332005c7648ee670aa10bb9b414;hp=13cf4d1087088bee57b04bf5141f95d5aa594836;hpb=6a1e1159a8a738e1607626a2dc2479f546ab4e49;p=p5sagit%2Fp5-mst-13.2.git diff --git a/reentr.pl b/reentr.pl index 13cf4d1..2fb9ff0 100644 --- a/reentr.pl +++ b/reentr.pl @@ -13,7 +13,7 @@ BEGIN { use strict; use Getopt::Std; my %opts; -getopts('U', \%opts); +getopts('Uv', \%opts); my %map = ( V => "void", @@ -40,16 +40,15 @@ 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; +# safer_unlink 'reentr.h'; +my $h = safer_open("reentr.h-new"); +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 /* Deprecations: some platforms have the said reentrant interfaces * but they are declared obsolete and are not to be used. Often this * means that the platform has threadsafed the interfaces (hopefully). * All this is OS version dependent, so we are of course fooling ourselves. - * If you know of more deprecations on some platforms, please add your own. */ + * If you know of more deprecations on some platforms, please add your own + * (by editing reentr.pl, mind!) */ #ifdef __hpux # undef HAS_CRYPT_R @@ -94,9 +109,9 @@ print <$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) @@ -634,6 +649,7 @@ EOF push @wrap, $ifdef; push @wrap, <_' . $genfunc . '_data))'; + $memzero = 'REENTR_MEMZERO(&PL_reentrant_buffer->_' . $genfunc . '_data, sizeof(PL_reentrant_buffer->_' . $genfunc . '_data)),'; } push @wrap, <reentr.c"); -binmode C; -select C; +# safer_unlink 'reentr.c'; +my $c = safer_open("reentr.c-new"); +select $c; print <op_type) { #ifdef USE_HOSTENT_BUFFER @@ -1049,17 +1075,20 @@ Perl_reentrant_retry(const char *f, ...) /* Not known how to retry, so just fail. */ break; } - - va_end(ap); #else PERL_UNUSED_ARG(f); #endif + } + va_end(ap); return retptr; } /* ex: set ro: */ EOF +safer_close($c); +rename_if_different('reentr.c-new', 'reentr.c'); + __DATA__ asctime S |time |const struct tm|B_SB|B_SBI|I_SB|I_SBI crypt CC |crypt |struct crypt_data|B_CCS|B_CCD|D=CRYPTD* @@ -1092,8 +1121,6 @@ getservbyname CC|netdb |struct servent |I_CCSBWR|S_CCSBI|I_CCSD|D=struct servent getservbyport IC|netdb |struct servent |I_ICSBWR|S_ICSBI|I_ICSD|D=struct servent_data* getservent |netdb |struct servent |I_SBWR|I_SBI|S_SBI|I_SD|D=struct servent_data* getspnam C |shadow |struct spwd |I_CSBWR|S_CSBI -gmtime T |time |struct tm |S_TS|I_TS|T=const time_t* -localtime T |time |struct tm |S_TS|I_TS|T=const time_t* random |stdlib |struct random_data|I_iS|I_lS|I_St|i=int*|l=long*|t=int32_t* readdir T |dirent |struct dirent |I_TSR|I_TS|T=DIR* readdir64 T |dirent |struct dirent64|I_TSR|I_TS|T=DIR*