cvs: php4 /ext/standard file.c

From: Date: Thu, 29 Jun 2000 13:34:55 +0000
Subject: cvs: php4 /ext/standard file.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-546@lists.php.net to get a copy of this message
stas Thu Jun 29 06:34:55 2000 EDT Modified files: /php4/ext/standard file.c Log: Make fgets not use maximal buffer length always, but shrink buffer if it's too big. Index: php4/ext/standard/file.c diff -u php4/ext/standard/file.c:1.96 php4/ext/standard/file.c:1.97 --- php4/ext/standard/file.c:1.96 Tue Jun 27 02:55:52 2000 +++ php4/ext/standard/file.c Thu Jun 29 06:34:55 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.96 2000/06/27 09:55:52 thies Exp $ */ +/* $Id: file.c,v 1.97 2000/06/29 13:34:55 stas Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -990,6 +990,10 @@ } else { return_value->value.str.val = buf; return_value->value.str.len = strlen(return_value->value.str.val); + /* resize buffer if it's much larger than the result */ + if(return_value->value.str.len < len/2) { + return_value->value.str.val = erealloc(buf,return_value->value.str.len); + } } return_value->type = IS_STRING; }

« previous php.cvs (#546) next »