diff options
author | Tony Cook <tony@develop-help.com> | 2013-09-10 10:09:43 +1000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2013-09-13 11:33:58 +1000 |
commit | a7f3e46aaac62b4972446c96e4492992cd667756 (patch) | |
tree | b55a7be402244b22d4c4b534fe29d38e16b3406a | |
parent | 890c2948b68476f972f9648473ed11faf48e159f (diff) | |
download | perl-a7f3e46aaac62b4972446c96e4492992cd667756.tar.gz |
[perl #115928] we don't use drand48_r or random_r any longer
Removing this should mean that metaconfig will remove the units from
the built Configure
-rw-r--r-- | reentr.c | 18 | ||||
-rw-r--r-- | reentr.h | 145 | ||||
-rw-r--r-- | regen/reentr.pl | 45 |
3 files changed, 38 insertions, 170 deletions
@@ -40,8 +40,6 @@ Perl_reentrant_size(pTHX) { #ifdef HAS_CTIME_R PL_reentrant_buffer->_ctime_size = REENTRANTSMALLSIZE; #endif /* HAS_CTIME_R */ -#ifdef HAS_DRAND48_R -#endif /* HAS_DRAND48_R */ #ifdef HAS_GETGRNAM_R # if defined(HAS_SYSCONF) && defined(_SC_GETGR_R_SIZE_MAX) && !defined(__GLIBC__) PL_reentrant_buffer->_grent_size = sysconf(_SC_GETGR_R_SIZE_MAX); @@ -116,8 +114,6 @@ Perl_reentrant_size(pTHX) { # endif # endif #endif /* HAS_GETSPNAM_R */ -#ifdef HAS_RANDOM_R -#endif /* HAS_RANDOM_R */ #ifdef HAS_READDIR_R /* This is the size Solaris recommends. * (though we go static, should use pathconf() instead) */ @@ -131,8 +127,6 @@ Perl_reentrant_size(pTHX) { #ifdef HAS_SETLOCALE_R PL_reentrant_buffer->_setlocale_size = REENTRANTSMALLSIZE; #endif /* HAS_SETLOCALE_R */ -#ifdef HAS_SRANDOM_R -#endif /* HAS_SRANDOM_R */ #ifdef HAS_STRERROR_R PL_reentrant_buffer->_strerror_size = REENTRANTSMALLSIZE; #endif /* HAS_STRERROR_R */ @@ -159,8 +153,6 @@ Perl_reentrant_init(pTHX) { #ifdef HAS_CTIME_R Newx(PL_reentrant_buffer->_ctime_buffer, PL_reentrant_buffer->_ctime_size, char); #endif /* HAS_CTIME_R */ -#ifdef HAS_DRAND48_R -#endif /* HAS_DRAND48_R */ #ifdef HAS_GETGRNAM_R # ifdef USE_GRENT_FPTR PL_reentrant_buffer->_grent_fptr = NULL; @@ -202,8 +194,6 @@ Perl_reentrant_init(pTHX) { # endif Newx(PL_reentrant_buffer->_spent_buffer, PL_reentrant_buffer->_spent_size, char); #endif /* HAS_GETSPNAM_R */ -#ifdef HAS_RANDOM_R -#endif /* HAS_RANDOM_R */ #ifdef HAS_READDIR_R PL_reentrant_buffer->_readdir_struct = (struct dirent*)safemalloc(PL_reentrant_buffer->_readdir_size); #endif /* HAS_READDIR_R */ @@ -213,8 +203,6 @@ Perl_reentrant_init(pTHX) { #ifdef HAS_SETLOCALE_R Newx(PL_reentrant_buffer->_setlocale_buffer, PL_reentrant_buffer->_setlocale_size, char); #endif /* HAS_SETLOCALE_R */ -#ifdef HAS_SRANDOM_R -#endif /* HAS_SRANDOM_R */ #ifdef HAS_STRERROR_R Newx(PL_reentrant_buffer->_strerror_buffer, PL_reentrant_buffer->_strerror_size, char); #endif /* HAS_STRERROR_R */ @@ -239,8 +227,6 @@ Perl_reentrant_free(pTHX) { #ifdef HAS_CTIME_R Safefree(PL_reentrant_buffer->_ctime_buffer); #endif /* HAS_CTIME_R */ -#ifdef HAS_DRAND48_R -#endif /* HAS_DRAND48_R */ #ifdef HAS_GETGRNAM_R Safefree(PL_reentrant_buffer->_grent_buffer); #endif /* HAS_GETGRNAM_R */ @@ -273,8 +259,6 @@ Perl_reentrant_free(pTHX) { #ifdef HAS_GETSPNAM_R Safefree(PL_reentrant_buffer->_spent_buffer); #endif /* HAS_GETSPNAM_R */ -#ifdef HAS_RANDOM_R -#endif /* HAS_RANDOM_R */ #ifdef HAS_READDIR_R Safefree(PL_reentrant_buffer->_readdir_struct); #endif /* HAS_READDIR_R */ @@ -284,8 +268,6 @@ Perl_reentrant_free(pTHX) { #ifdef HAS_SETLOCALE_R Safefree(PL_reentrant_buffer->_setlocale_buffer); #endif /* HAS_SETLOCALE_R */ -#ifdef HAS_SRANDOM_R -#endif /* HAS_SRANDOM_R */ #ifdef HAS_STRERROR_R Safefree(PL_reentrant_buffer->_strerror_buffer); #endif /* HAS_STRERROR_R */ @@ -41,13 +41,11 @@ #ifdef __hpux # undef HAS_CRYPT_R -# undef HAS_DRAND48_R # undef HAS_ENDGRENT_R # undef HAS_ENDPWENT_R # undef HAS_GETGRENT_R # undef HAS_GETPWENT_R # undef HAS_SETLOCALE_R -# undef HAS_SRAND48_R # undef HAS_STRERROR_R # define NETDB_R_OBSOLETE #endif @@ -101,9 +99,6 @@ #ifdef I_NETDB # include <netdb.h> #endif -#ifdef I_STDLIB -# include <stdlib.h> /* drand48_data */ -#endif #ifdef I_CRYPT # ifdef I_CRYPT # include <crypt.h> @@ -150,48 +145,43 @@ #define REENTRANT_PROTO_I_ISD 33 #define REENTRANT_PROTO_I_LISBI 34 #define REENTRANT_PROTO_I_LISD 35 -#define REENTRANT_PROTO_I_LS 36 -#define REENTRANT_PROTO_I_SB 37 -#define REENTRANT_PROTO_I_SBI 38 -#define REENTRANT_PROTO_I_SBIE 39 -#define REENTRANT_PROTO_I_SBIH 40 -#define REENTRANT_PROTO_I_SBIR 41 -#define REENTRANT_PROTO_I_SBWR 42 -#define REENTRANT_PROTO_I_SBWRE 43 -#define REENTRANT_PROTO_I_SD 44 -#define REENTRANT_PROTO_I_ST 45 -#define REENTRANT_PROTO_I_St 46 -#define REENTRANT_PROTO_I_TISD 47 -#define REENTRANT_PROTO_I_TS 48 -#define REENTRANT_PROTO_I_TSBI 49 -#define REENTRANT_PROTO_I_TSBIR 50 -#define REENTRANT_PROTO_I_TSBWR 51 -#define REENTRANT_PROTO_I_TSR 52 -#define REENTRANT_PROTO_I_TsISBWRE 53 -#define REENTRANT_PROTO_I_UISBWRE 54 -#define REENTRANT_PROTO_I_iS 55 -#define REENTRANT_PROTO_I_lS 56 -#define REENTRANT_PROTO_I_uISBWRE 57 -#define REENTRANT_PROTO_S_CBI 58 -#define REENTRANT_PROTO_S_CCSBI 59 -#define REENTRANT_PROTO_S_CIISBIE 60 -#define REENTRANT_PROTO_S_CSBI 61 -#define REENTRANT_PROTO_S_CSBIE 62 -#define REENTRANT_PROTO_S_CWISBIE 63 -#define REENTRANT_PROTO_S_CWISBWIE 64 -#define REENTRANT_PROTO_S_ICSBI 65 -#define REENTRANT_PROTO_S_ISBI 66 -#define REENTRANT_PROTO_S_LISBI 67 -#define REENTRANT_PROTO_S_SBI 68 -#define REENTRANT_PROTO_S_SBIE 69 -#define REENTRANT_PROTO_S_SBW 70 -#define REENTRANT_PROTO_S_TISBI 71 -#define REENTRANT_PROTO_S_TSBI 72 -#define REENTRANT_PROTO_S_TSBIE 73 -#define REENTRANT_PROTO_S_TWISBIE 74 -#define REENTRANT_PROTO_V_D 75 -#define REENTRANT_PROTO_V_H 76 -#define REENTRANT_PROTO_V_ID 77 +#define REENTRANT_PROTO_I_SB 36 +#define REENTRANT_PROTO_I_SBI 37 +#define REENTRANT_PROTO_I_SBIE 38 +#define REENTRANT_PROTO_I_SBIH 39 +#define REENTRANT_PROTO_I_SBIR 40 +#define REENTRANT_PROTO_I_SBWR 41 +#define REENTRANT_PROTO_I_SBWRE 42 +#define REENTRANT_PROTO_I_SD 43 +#define REENTRANT_PROTO_I_TISD 44 +#define REENTRANT_PROTO_I_TS 45 +#define REENTRANT_PROTO_I_TSBI 46 +#define REENTRANT_PROTO_I_TSBIR 47 +#define REENTRANT_PROTO_I_TSBWR 48 +#define REENTRANT_PROTO_I_TSR 49 +#define REENTRANT_PROTO_I_TsISBWRE 50 +#define REENTRANT_PROTO_I_UISBWRE 51 +#define REENTRANT_PROTO_I_uISBWRE 52 +#define REENTRANT_PROTO_S_CBI 53 +#define REENTRANT_PROTO_S_CCSBI 54 +#define REENTRANT_PROTO_S_CIISBIE 55 +#define REENTRANT_PROTO_S_CSBI 56 +#define REENTRANT_PROTO_S_CSBIE 57 +#define REENTRANT_PROTO_S_CWISBIE 58 +#define REENTRANT_PROTO_S_CWISBWIE 59 +#define REENTRANT_PROTO_S_ICSBI 60 +#define REENTRANT_PROTO_S_ISBI 61 +#define REENTRANT_PROTO_S_LISBI 62 +#define REENTRANT_PROTO_S_SBI 63 +#define REENTRANT_PROTO_S_SBIE 64 +#define REENTRANT_PROTO_S_SBW 65 +#define REENTRANT_PROTO_S_TISBI 66 +#define REENTRANT_PROTO_S_TSBI 67 +#define REENTRANT_PROTO_S_TSBIE 68 +#define REENTRANT_PROTO_S_TWISBIE 69 +#define REENTRANT_PROTO_V_D 70 +#define REENTRANT_PROTO_V_H 71 +#define REENTRANT_PROTO_V_ID 72 /* Defines for indicating which special features are supported. */ @@ -639,10 +629,6 @@ typedef struct { char* _ctime_buffer; size_t _ctime_size; #endif /* HAS_CTIME_R */ -#ifdef HAS_DRAND48_R - struct drand48_data _drand48_struct; - double _drand48_double; -#endif /* HAS_DRAND48_R */ #ifdef HAS_GETGRNAM_R struct group _grent_struct; char* _grent_buffer; @@ -740,18 +726,6 @@ typedef struct { FILE* _spent_fptr; # endif #endif /* HAS_GETSPNAM_R */ -#ifdef HAS_RANDOM_R - struct random_data _random_struct; -# if RANDOM_R_PROTO == REENTRANT_PROTO_I_iS - int _random_retval; -# endif -# if RANDOM_R_PROTO == REENTRANT_PROTO_I_lS - long _random_retval; -# endif -# if RANDOM_R_PROTO == REENTRANT_PROTO_I_St - int32_t _random_retval; -# endif -#endif /* HAS_RANDOM_R */ #ifdef HAS_READDIR_R struct dirent* _readdir_struct; size_t _readdir_size; @@ -770,9 +744,6 @@ typedef struct { char* _setlocale_buffer; size_t _setlocale_size; #endif /* HAS_SETLOCALE_R */ -#ifdef HAS_SRANDOM_R - struct random_data _srandom_struct; -#endif /* HAS_SRANDOM_R */ #ifdef HAS_STRERROR_R char* _strerror_buffer; size_t _strerror_size; @@ -844,15 +815,6 @@ typedef struct { # endif #endif /* HAS_CTIME_R */ -#ifdef HAS_DRAND48_R -# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) -# undef drand48 -# if !defined(drand48) && DRAND48_R_PROTO == REENTRANT_PROTO_I_ST -# define drand48() (drand48_r(&PL_reentrant_buffer->_drand48_struct, &PL_reentrant_buffer->_drand48_double) == 0 ? PL_reentrant_buffer->_drand48_double : 0) -# endif -# endif -#endif /* HAS_DRAND48_R */ - #ifdef HAS_ENDGRENT_R # if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) # undef endgrent @@ -1324,21 +1286,6 @@ typedef struct { # endif #endif /* HAS_GETSPNAM_R */ -#ifdef HAS_RANDOM_R -# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) -# undef random -# if !defined(random) && RANDOM_R_PROTO == REENTRANT_PROTO_I_iS -# define random() (random_r(&PL_reentrant_buffer->_random_retval, &PL_reentrant_buffer->_random_struct) == 0 ? PL_reentrant_buffer->_random_retval : 0) -# endif -# if !defined(random) && RANDOM_R_PROTO == REENTRANT_PROTO_I_lS -# define random() (random_r(&PL_reentrant_buffer->_random_retval, &PL_reentrant_buffer->_random_struct) == 0 ? PL_reentrant_buffer->_random_retval : 0) -# endif -# if !defined(random) && RANDOM_R_PROTO == REENTRANT_PROTO_I_St -# define random() (random_r(&PL_reentrant_buffer->_random_struct, &PL_reentrant_buffer->_random_retval) == 0 ? PL_reentrant_buffer->_random_retval : 0) -# endif -# endif -#endif /* HAS_RANDOM_R */ - #ifdef HAS_READDIR_R # if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) # undef readdir @@ -1444,24 +1391,6 @@ typedef struct { # endif #endif /* HAS_SETSERVENT_R */ -#ifdef HAS_SRAND48_R -# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) -# undef srand48 -# if !defined(srand48) && SRAND48_R_PROTO == REENTRANT_PROTO_I_LS -# define srand48(a) (srand48_r(a, &PL_reentrant_buffer->_drand48_struct) == 0 ? &PL_reentrant_buffer->_drand48_struct : 0) -# endif -# endif -#endif /* HAS_SRAND48_R */ - -#ifdef HAS_SRANDOM_R -# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) -# undef srandom -# if !defined(srandom) && SRANDOM_R_PROTO == REENTRANT_PROTO_I_TS -# define srandom(a) (srandom_r(a, &PL_reentrant_buffer->_srandom_struct) == 0 ? &PL_reentrant_buffer->_srandom_struct : 0) -# endif -# endif -#endif /* HAS_SRANDOM_R */ - #ifdef HAS_STRERROR_R # if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) # undef strerror diff --git a/regen/reentr.pl b/regen/reentr.pl index c5e7129f1b..6dac2996ad 100644 --- a/regen/reentr.pl +++ b/regen/reentr.pl @@ -91,13 +91,11 @@ print $h <<EOF; #ifdef __hpux # undef HAS_CRYPT_R -# undef HAS_DRAND48_R # undef HAS_ENDGRENT_R # undef HAS_ENDPWENT_R # undef HAS_GETGRENT_R # undef HAS_GETPWENT_R # undef HAS_SETLOCALE_R -# undef HAS_SRAND48_R # undef HAS_STRERROR_R # define NETDB_R_OBSOLETE #endif @@ -151,9 +149,6 @@ print $h <<EOF; #ifdef I_NETDB # include <netdb.h> #endif -#ifdef I_STDLIB -# include <stdlib.h> /* drand48_data */ -#endif #ifdef I_CRYPT # ifdef I_CRYPT # include <crypt.h> @@ -504,30 +499,6 @@ EOF EOF pushssif $endif; } - elsif ($func =~ /^(drand48|random|srandom)$/) { - pushssif $ifdef; - push @struct, <<EOF; - $seent{$func} _${func}_struct; -EOF - if ($1 eq 'drand48') { - push @struct, <<EOF; - double _${func}_double; -EOF - } elsif ($1 eq 'random') { - push @struct, <<EOF; -# if RANDOM_R_PROTO == REENTRANT_PROTO_I_iS - int _${func}_retval; -# endif -# if RANDOM_R_PROTO == REENTRANT_PROTO_I_lS - long _${func}_retval; -# endif -# if RANDOM_R_PROTO == REENTRANT_PROTO_I_St - int32_t _${func}_retval; -# endif -EOF - } - pushssif $endif; - } elsif ($func =~ /^(getgrnam|getpwnam|getspnam)$/) { pushssif $ifdef; # 'genfunc' can be read either as 'generic' or 'genre', @@ -664,18 +635,12 @@ EOF my $genfunc = $func; if ($genfunc =~ /^(?:get|set|end)(pw|gr|host|net|proto|serv|sp)/) { $genfunc = "${1}ent"; - } elsif ($genfunc eq 'srand48') { - $genfunc = "drand48"; } my $b = $a; my $w = ''; substr($b, 0, $seenu{$func}) = ''; - if ($func =~ /^random$/) { - $true = "PL_reentrant_buffer->_random_retval"; - } elsif ($b =~ /R/) { + if ($b =~ /R/) { $true = "PL_reentrant_buffer->_${genfunc}_ptr"; - } elsif ($b =~ /T/ && $func eq 'drand48') { - $true = "PL_reentrant_buffer->_${genfunc}_double"; } elsif ($b =~ /S/) { if ($func =~ /^readdir/) { $true = "PL_reentrant_buffer->_${genfunc}_struct"; @@ -706,10 +671,6 @@ EOF $func =~ /^crypt$/ ? "PL_reentrant_buffer->_${genfunc}_struct_buffer" : "&PL_reentrant_buffer->_${genfunc}_struct") : - $_ eq 'T' && $func eq 'drand48' ? - "&PL_reentrant_buffer->_${genfunc}_double" : - $_ =~ /^[ilt]$/ && $func eq 'random' ? - "&PL_reentrant_buffer->_random_retval" : $_ } split '', $b; $w = ", $w" if length $v; @@ -1076,7 +1037,6 @@ 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* ctermid B |stdio | |B_B ctime S |time |const time_t |B_SB|B_SBI|I_SB|I_SBI -drand48 |stdlib |struct drand48_data |I_ST|T=double* endgrent |grp | |I_H|V_H endhostent |netdb | |I_D|V_D|D=struct hostent_data* endnetent |netdb | |I_D|V_D|D=struct netent_data* @@ -1103,7 +1063,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 -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* setgrent |grp | |I_H|V_H @@ -1113,8 +1072,6 @@ setnetent I |netdb | |I_ID|V_ID|D=struct netent_data* setprotoent I |netdb | |I_ID|V_ID|D=struct protoent_data* setpwent |pwd | |I_H|V_H setservent I |netdb | |I_ID|V_ID|D=struct servent_data* -srand48 L |stdlib |struct drand48_data |I_LS -srandom T |stdlib |struct random_data|I_TS|T=unsigned int strerror I |string | |I_IBW|I_IBI|B_IBW tmpnam B |stdio | |B_B ttyname I |unistd | |I_IBW|I_IBI|B_IBI |