summaryrefslogtreecommitdiff
path: root/reentr.pl
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-09-27 04:08:56 +0300
committerhv <hv@crypt.org>2002-10-02 15:04:57 +0000
commitaf685957336d0a37645ff959496386c489e0b52a (patch)
tree0bf174a4e022dbc1a9ff2cb2ba7ebbd5d8ae436b /reentr.pl
parent77b096b5f2a0becf5ed578f9a5dea854fda8c05b (diff)
downloadperl-af685957336d0a37645ff959496386c489e0b52a.tar.gz
reentrant buffers
Message-ID: <20020926220856.GA339120@lyta.hut.fi> p4raw-id: //depot/perl@17967
Diffstat (limited to 'reentr.pl')
-rw-r--r--reentr.pl61
1 files changed, 53 insertions, 8 deletions
diff --git a/reentr.pl b/reentr.pl
index b2a6b917f6..1f4e6ac402 100644
--- a/reentr.pl
+++ b/reentr.pl
@@ -784,19 +784,24 @@ 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
+#ifdef PERL_REENTRANT_MAXSIZE
+ static const char larger[] = "Result from %s larger than %d bytes";
+#endif
va_list ap;
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);
@@ -823,7 +828,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,
@@ -849,7 +858,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,
@@ -868,6 +881,11 @@ Perl_reentrant_retry(const char *f, ...)
break;
}
}
+#ifdef PERL_REENTRANT_MAXSIZE
+ else if (ckWARN(WARN_MISC))
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ larger, OP_NAME(PL_op), PERL_REENTRANT_MAXSIZE);
+#endif
}
break;
#endif
@@ -876,7 +894,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,
@@ -894,6 +916,11 @@ Perl_reentrant_retry(const char *f, ...)
break;
}
}
+#ifdef PERL_REENTRANT_MAXSIZE
+ else if (ckWARN(WARN_MISC))
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ larger, OP_NAME(PL_op), PERL_REENTRANT_MAXSIZE);
+#endif
}
break;
#endif
@@ -902,7 +929,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);
@@ -919,6 +950,11 @@ Perl_reentrant_retry(const char *f, ...)
break;
}
}
+#ifdef PERL_REENTRANT_MAXSIZE
+ else if (ckWARN(WARN_MISC))
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ larger, OP_NAME(PL_op), PERL_REENTRANT_MAXSIZE);
+#endif
}
break;
#endif
@@ -927,7 +963,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);
@@ -946,6 +986,11 @@ Perl_reentrant_retry(const char *f, ...)
break;
}
}
+#ifdef PERL_REENTRANT_MAXSIZE
+ else if (ckWARN(WARN_MISC))
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ larger, OP_NAME(PL_op), PERL_REENTRANT_MAXSIZE);
+#endif
}
break;
#endif