helly           Mon Mar  7 16:28:38 2005 EDT

  Modified files:              
    /php-src/ext/standard       file.c 
  Log:
  - Delay memory allocation, speeds up faiure case
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/file.c?r1=1.400&r2=1.401&ty=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.400 php-src/ext/standard/file.c:1.401
--- php-src/ext/standard/file.c:1.400   Sun Mar  6 19:16:18 2005
+++ php-src/ext/standard/file.c Mon Mar  7 16:28:38 2005
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: file.c,v 1.400 2005/03/07 00:16:18 helly Exp $ */
+/* $Id: file.c,v 1.401 2005/03/07 21:28:38 helly Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -1052,7 +1052,7 @@
 PHPAPI PHP_FUNCTION(fgetc)
 {
        zval **arg1;
-       char *buf;
+       char buf[2];
        int result;
        php_stream *stream;
 
@@ -1062,18 +1062,15 @@
 
        PHP_STREAM_TO_ZVAL(stream, arg1);
 
-       buf = safe_emalloc(2, sizeof(char), 0);
-
        result = php_stream_getc(stream);
 
        if (result == EOF) {
-               efree(buf);
                RETVAL_FALSE;
        } else {
                buf[0] = result;
                buf[1] = '\0';
 
-               RETURN_STRINGL(buf, 1, 0);
+               RETURN_STRINGL(buf, 1, 1);
        }
 }
 /* }}} */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to