From: Jarkko Hietaniemi Date: Tue, 29 Jul 2003 11:18:27 +0000 (+0000) Subject: Cleanup the sv_gets() logic for platforms with small stacks. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6edd2cd5e1bfb21f9c181908df9edd7f62fdb48c;p=p5sagit%2Fp5-mst-13.2.git Cleanup the sv_gets() logic for platforms with small stacks. (I think hogging 8K of stack sounds like bad behaviour on any platform, big stack or not.) p4raw-id: //depot/perl@20300 --- diff --git a/sv.c b/sv.c index c31ada7..1b76e02 100644 --- a/sv.c +++ b/sv.c @@ -6622,15 +6622,23 @@ thats_really_all_folks: } else { -#ifndef EPOC - /*The big, slow, and stupid way */ - STDCHAR buf[8192]; + /*The big, slow, and stupid way. */ + + /* Any stack-challenged places. */ +#if defined(EPOC) || 1 + /* EPOC: need to work around SDK features. * + * On WINS: MS VC5 generates calls to _chkstk, * + * if a "large" stack frame is allocated. * + * gcc on MARM does not generate calls like these. */ +# define USEHEAPINSTEADOFSTACK +#endif + +#ifdef USEHEAPINSTEADOFSTACK + STDCHAR *buf = 0; + New(0, buf, 8192, STDCHAR); + assert(buf); #else - /* Need to work around EPOC SDK features */ - /* On WINS: MS VC5 generates calls to _chkstk, */ - /* if a `large' stack frame is allocated */ - /* gcc on MARM does not generate calls like these */ - STDCHAR buf[1024]; + STDCHAR buf[8192]; #endif screamer2: @@ -6679,6 +6687,10 @@ screamer2: if (!(cnt < sizeof(buf) && PerlIO_eof(fp))) goto screamer2; } + +#ifdef USEHEAPINSTEADOFSTACK + Safefree(buf); +#endif } if (rspara) { /* have to do this both before and after */