This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #121431] Add support for test.valgrind parallel testing.
[perl5.git] / reentr.c
index 9447fc3..917807c 100644 (file)
--- a/reentr.c
+++ b/reentr.c
@@ -7,8 +7,9 @@
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
  *
- *  !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
- *  This file is built by reentr.pl from data in reentr.pl.
+ * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
+ * This file is built by regen/reentr.pl from data in regen/reentr.pl.
+ * Any changes made here will be lost!
  *
  * "Saruman," I said, standing away from him, "only one hand at a time can
  *  wield the One, and you know that well, so do not trouble to say we!"
@@ -39,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);
@@ -115,12 +114,6 @@ Perl_reentrant_size(pTHX) {
 #       endif
 #   endif 
 #endif /* HAS_GETSPNAM_R */
-#ifdef HAS_GMTIME_R
-#endif /* HAS_GMTIME_R */
-#ifdef HAS_LOCALTIME_R
-#endif /* HAS_LOCALTIME_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) */
@@ -134,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 */
@@ -162,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;
@@ -205,12 +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_GMTIME_R
-#endif /* HAS_GMTIME_R */
-#ifdef HAS_LOCALTIME_R
-#endif /* HAS_LOCALTIME_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 */
@@ -220,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 */
@@ -246,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 */
@@ -280,12 +259,6 @@ Perl_reentrant_free(pTHX) {
 #ifdef HAS_GETSPNAM_R
        Safefree(PL_reentrant_buffer->_spent_buffer);
 #endif /* HAS_GETSPNAM_R */
-#ifdef HAS_GMTIME_R
-#endif /* HAS_GMTIME_R */
-#ifdef HAS_LOCALTIME_R
-#endif /* HAS_LOCALTIME_R */
-#ifdef HAS_RANDOM_R
-#endif /* HAS_RANDOM_R */
 #ifdef HAS_READDIR_R
        Safefree(PL_reentrant_buffer->_readdir_struct);
 #endif /* HAS_READDIR_R */
@@ -295,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 */
@@ -311,8 +282,16 @@ Perl_reentrant_free(pTHX) {
 void*
 Perl_reentrant_retry(const char *f, ...)
 {
-    dTHX;
     void *retptr = NULL;
+    va_list ap;
+#ifdef USE_REENTRANT_API
+    dTHX;
+    /* Easier to special case this here than in embed.pl. (Look at what it
+       generates for proto.h) */
+    PERL_ARGS_ASSERT_REENTRANT_RETRY;
+#endif
+    va_start(ap, f);
+    {
 #ifdef USE_REENTRANT_API
 #  if defined(USE_HOSTENT_BUFFER) || defined(USE_GRENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PWENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER)
     void *p0;
@@ -326,9 +305,6 @@ Perl_reentrant_retry(const char *f, ...)
 #  if defined(USE_HOSTENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER)
     int anint;
 #  endif
-    va_list ap;
-
-    va_start(ap, f);
 
     switch (PL_op->op_type) {
 #ifdef USE_HOSTENT_BUFFER
@@ -455,8 +431,10 @@ Perl_reentrant_retry(const char *f, ...)
                    uid = va_arg(ap, Uid_t);
 #endif
                    retptr = getpwuid(uid); break;
+#if defined(HAS_GETPWENT) || defined(HAS_GETPWENT_R)
                case OP_GPWENT:
                    retptr = getpwent(); break;
+#endif
                default:
                    SETERRNO(ERANGE, LIB_INVARG);
                    break;
@@ -531,11 +509,11 @@ 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;
 }