iliaa Tue, 09 Aug 2011 13:10:57 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=314648
Log:
Minimize stack usage and added missing dtors
Changed paths:
U php/php-src/branches/PHP_5_3/ext/standard/dns.c
U php/php-src/branches/PHP_5_4/ext/standard/dns.c
U php/php-src/trunk/ext/standard/dns.c
Modified: php/php-src/branches/PHP_5_3/ext/standard/dns.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/dns.c 2011-08-09 13:09:42 UTC
(rev 314647)
+++ php/php-src/branches/PHP_5_3/ext/standard/dns.c 2011-08-09 13:10:57 UTC
(rev 314648)
@@ -118,7 +118,7 @@
Get the host name of the current machine */
PHP_FUNCTION(gethostname)
{
- char buf[4096];
+ char buf[MAXHOSTNAMELEN];
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -794,12 +794,14 @@
#if defined(HAVE_DNS_SEARCH)
handle = dns_open(NULL);
if (handle == NULL) {
+ zval_dtor(return_value);
RETURN_FALSE;
}
#elif defined(HAVE_RES_NSEARCH)
memset(&state, 0, sizeof(state));
if (res_ninit(handle)) {
- RETURN_FALSE;
+ zval_dtor(return_value);
+ RETURN_FALSE;
}
#else
res_init();
Modified: php/php-src/branches/PHP_5_4/ext/standard/dns.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/standard/dns.c 2011-08-09 13:09:42 UTC
(rev 314647)
+++ php/php-src/branches/PHP_5_4/ext/standard/dns.c 2011-08-09 13:10:57 UTC
(rev 314648)
@@ -118,7 +118,7 @@
Get the host name of the current machine */
PHP_FUNCTION(gethostname)
{
- char buf[4096];
+ char buf[MAXHOSTNAMELEN];
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -830,12 +830,14 @@
#if defined(HAVE_DNS_SEARCH)
handle = dns_open(NULL);
if (handle == NULL) {
+ zval_dtor(return_value);
RETURN_FALSE;
}
#elif defined(HAVE_RES_NSEARCH)
memset(&state, 0, sizeof(state));
if (res_ninit(handle)) {
- RETURN_FALSE;
+ zval_dtor(return_value);
+ RETURN_FALSE;
}
#else
res_init();
Modified: php/php-src/trunk/ext/standard/dns.c
===================================================================
--- php/php-src/trunk/ext/standard/dns.c 2011-08-09 13:09:42 UTC (rev
314647)
+++ php/php-src/trunk/ext/standard/dns.c 2011-08-09 13:10:57 UTC (rev
314648)
@@ -118,7 +118,7 @@
Get the host name of the current machine */
PHP_FUNCTION(gethostname)
{
- char buf[4096];
+ char buf[MAXHOSTNAMELEN];
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -830,12 +830,14 @@
#if defined(HAVE_DNS_SEARCH)
handle = dns_open(NULL);
if (handle == NULL) {
+ zval_dtor(return_value);
RETURN_FALSE;
}
#elif defined(HAVE_RES_NSEARCH)
memset(&state, 0, sizeof(state));
if (res_ninit(handle)) {
- RETURN_FALSE;
+ zval_dtor(return_value);
+ RETURN_FALSE;
}
#else
res_init();
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php