Further tweaks to perluniintro.pod
[p5sagit/p5-mst-13.2.git] / reentr.pl
index 19b9852..85ec64a 100644 (file)
--- a/reentr.pl
+++ b/reentr.pl
@@ -204,6 +204,9 @@ while (<DATA>) { # Read in the protypes.
 ?S:.
 ?S:${func}_r_proto:
 ?S:    This variable encodes the prototype of ${func}_r.
+?S:    It is zero if d_${func}_r is undef, and one of the
+?S:    REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
+?S:    is defined.
 ?S:.
 ?C:HAS_${FUNC}_R:
 ?C:    This symbol, if defined, indicates that the ${func}_r routine
@@ -211,6 +214,9 @@ while (<DATA>) { # Read in the protypes.
 ?C:.
 ?C:${FUNC}_R_PROTO:
 ?C:    This symbol encodes the prototype of ${func}_r.
+?C:    It is zero if d_${func}_r is undef, and one of the
+?C:    REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
+?C:    is defined.
 ?C:.
 ?H:#\$d_${func}_r HAS_${FUNC}_R           /**/
 ?H:#define ${FUNC}_R_PROTO \$${func}_r_proto      /**/
@@ -451,6 +457,8 @@ EOF
            push @init, <<EOF;
 #ifdef __GLIBC__
        PL_reentrant_buffer->_${func}_struct.initialized = 0;
+       /* work around glibc-2.2.5 bug */
+       PL_reentrant_buffer->_${func}_struct.current_saltbits = 0;
 #endif
 EOF
            pushssif $endif;
@@ -780,15 +788,17 @@ Perl_reentrant_retry(const char *f, ...)
 
     va_start(ap, f);
 
-#define REENTRANTHALFMAXSIZE 32768 /* The maximum may end up twice this. */
-
     switch (PL_op->op_type) {
 #ifdef USE_HOSTENT_BUFFER
     case OP_GHBYADDR:
     case OP_GHBYNAME:
     case OP_GHOSTENT:
        {
-           if (PL_reentrant_buffer->_hostent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+           if (PL_reentrant_buffer->_hostent_size <=
+               PERL_REENTRANT_MAXSIZE / 2)
+#endif
+           {
                PL_reentrant_buffer->_hostent_size *= 2;
                Renew(PL_reentrant_buffer->_hostent_buffer,
                      PL_reentrant_buffer->_hostent_size, char);
@@ -815,7 +825,11 @@ Perl_reentrant_retry(const char *f, ...)
     case OP_GGRGID:
     case OP_GGRENT:
        {
-           if (PL_reentrant_buffer->_grent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+           if (PL_reentrant_buffer->_grent_size <=
+               PERL_REENTRANT_MAXSIZE / 2)
+#endif
+           {
                Gid_t gid;
                PL_reentrant_buffer->_grent_size *= 2;
                Renew(PL_reentrant_buffer->_grent_buffer,
@@ -841,7 +855,11 @@ Perl_reentrant_retry(const char *f, ...)
     case OP_GNBYNAME:
     case OP_GNETENT:
        {
-           if (PL_reentrant_buffer->_netent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+           if (PL_reentrant_buffer->_netent_size <=
+               PERL_REENTRANT_MAXSIZE / 2)
+#endif
+           {
                Netdb_net_t net;
                PL_reentrant_buffer->_netent_size *= 2;
                Renew(PL_reentrant_buffer->_netent_buffer,
@@ -860,6 +878,7 @@ Perl_reentrant_retry(const char *f, ...)
                    break;
                }
            }
+           SETERRNO(ERANGE, LIB_INVARG);
        }
        break;
 #endif
@@ -868,7 +887,11 @@ Perl_reentrant_retry(const char *f, ...)
     case OP_GPWUID:
     case OP_GPWENT:
        {
-           if (PL_reentrant_buffer->_pwent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+           if (PL_reentrant_buffer->_pwent_size <=
+               PERL_REENTRANT_MAXSIZE / 2)
+#endif
+           {
                Uid_t uid;
                PL_reentrant_buffer->_pwent_size *= 2;
                Renew(PL_reentrant_buffer->_pwent_buffer,
@@ -886,6 +909,7 @@ Perl_reentrant_retry(const char *f, ...)
                    break;
                }
            }
+           SETERRNO(ERANGE, LIB_INVARG);
        }
        break;
 #endif
@@ -894,7 +918,11 @@ Perl_reentrant_retry(const char *f, ...)
     case OP_GPBYNUMBER:
     case OP_GPROTOENT:
        {
-           if (PL_reentrant_buffer->_protoent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+           if (PL_reentrant_buffer->_protoent_size <=
+               PERL_REENTRANT_MAXSIZE / 2)
+#endif
+           {
                PL_reentrant_buffer->_protoent_size *= 2;
                Renew(PL_reentrant_buffer->_protoent_buffer,
                      PL_reentrant_buffer->_protoent_size, char);
@@ -911,6 +939,7 @@ Perl_reentrant_retry(const char *f, ...)
                    break;
                }
            }
+           SETERRNO(ERANGE, LIB_INVARG);
        }
        break;
 #endif
@@ -919,7 +948,11 @@ Perl_reentrant_retry(const char *f, ...)
     case OP_GSBYPORT:
     case OP_GSERVENT:
        {
-           if (PL_reentrant_buffer->_servent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+           if (PL_reentrant_buffer->_servent_size <=
+               PERL_REENTRANT_MAXSIZE / 2)
+#endif
+           {
                PL_reentrant_buffer->_servent_size *= 2;
                Renew(PL_reentrant_buffer->_servent_buffer,
                      PL_reentrant_buffer->_servent_size, char);
@@ -938,6 +971,7 @@ Perl_reentrant_retry(const char *f, ...)
                    break;
                }
            }
+           SETERRNO(ERANGE, LIB_INVARG);
        }
        break;
 #endif