cvs: php4 /ext/sockets sockets.c

From: Date: Tue, 30 Apr 2002 22:01:06 +0000
Subject: cvs: php4 /ext/sockets sockets.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-11575@lists.php.net to get a copy of this message
mfischer Tue Apr 30 18:01:06 2002 EDT Modified files: /php4/ext/sockets sockets.c Log: - Allow resetting the module global last_error too. Index: php4/ext/sockets/sockets.c diff -u php4/ext/sockets/sockets.c:1.100 php4/ext/sockets/sockets.c:1.101 --- php4/ext/sockets/sockets.c:1.100 Mon Apr 29 11:06:48 2002 +++ php4/ext/sockets/sockets.c Tue Apr 30 18:01:06 2002 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sockets.c,v 1.100 2002/04/29 15:06:48 mfischer Exp $ */ +/* $Id: sockets.c,v 1.101 2002/04/30 22:01:06 mfischer Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1939,18 +1939,21 @@ /* }}} */ /* {{{ proto void socket_clear_error(resource socket) - Clears the error on the socket */ + Clears the error on the socket or the last error code. */ PHP_FUNCTION(socket_clear_error) { - zval *arg1; + zval *arg1 = NULL; php_socket *php_sock; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &arg1) == FAILURE) return; - ZEND_FETCH_RESOURCE(php_sock, php_socket*, &arg1, -1, le_socket_name, le_socket); - - php_sock->error = 0; + if (arg1) { + ZEND_FETCH_RESOURCE(php_sock, php_socket*, &arg1, -1, le_socket_name, le_socket); + php_sock->error = 0; + } else { + SOCKETS_G(last_error) = 0; + } return; }

« previous php.cvs (#11575) next »