diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2002-09-27 04:08:56 +0300 |
---|---|---|
committer | hv <hv@crypt.org> | 2002-10-02 15:04:57 +0000 |
commit | af685957336d0a37645ff959496386c489e0b52a (patch) | |
tree | 0bf174a4e022dbc1a9ff2cb2ba7ebbd5d8ae436b /reentr.c | |
parent | 77b096b5f2a0becf5ed578f9a5dea854fda8c05b (diff) | |
download | perl-af685957336d0a37645ff959496386c489e0b52a.tar.gz |
reentrant buffers
Message-ID: <20020926220856.GA339120@lyta.hut.fi>
p4raw-id: //depot/perl@17967
Diffstat (limited to 'reentr.c')
-rw-r--r-- | reentr.c | 61 |
1 files changed, 53 insertions, 8 deletions
@@ -312,19 +312,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); @@ -351,7 +356,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, @@ -377,7 +386,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, @@ -396,6 +409,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 @@ -404,7 +422,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, @@ -422,6 +444,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 @@ -430,7 +457,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); @@ -447,6 +478,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 @@ -455,7 +491,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); @@ -474,6 +514,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 |