felipe                                   Sat, 01 Oct 2011 13:01:12 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=317599

Log:
- Improve void arg check
- Removed unused variable
- Added check for empty tag in enchant_broker_request_dict() (to avoid assert 
warning)

Changed paths:
    U   php/php-src/branches/PHP_5_4/ext/enchant/enchant.c
    U   php/php-src/trunk/ext/enchant/enchant.c

Modified: php/php-src/branches/PHP_5_4/ext/enchant/enchant.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/enchant/enchant.c  2011-10-01 11:10:20 UTC 
(rev 317598)
+++ php/php-src/branches/PHP_5_4/ext/enchant/enchant.c  2011-10-01 13:01:12 UTC 
(rev 317599)
@@ -244,8 +244,8 @@
                        if (broker->pbroker) {
                                if (broker->dictcnt && broker->dict) {
                                        if (broker->dict) {
-                                               int total, tofree;
-                                               tofree = total = 
broker->dictcnt-1;
+                                               int total;
+                                               total = broker->dictcnt-1;
                                                do {
                                                        
zend_list_delete(broker->dict[total]->rsrc_id);
                                                        
efree(broker->dict[total]);
@@ -357,8 +357,8 @@
        enchant_broker *broker;
        EnchantBroker *pbroker;

-       if (ZEND_NUM_ARGS()) {
-               ZEND_WRONG_PARAM_COUNT();
+       if (zend_parse_parameters_none() == FAILURE) {
+               return;
        }

        pbroker = enchant_broker_init();
@@ -542,6 +542,11 @@
        }

        PHP_ENCHANT_GET_BROKER;
+
+       if (taglen == 0) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tag cannot be 
empty");
+               RETURN_FALSE;
+       }

        d = enchant_broker_request_dict(pbroker->pbroker, (const char *)tag);
        if (d) {

Modified: php/php-src/trunk/ext/enchant/enchant.c
===================================================================
--- php/php-src/trunk/ext/enchant/enchant.c     2011-10-01 11:10:20 UTC (rev 
317598)
+++ php/php-src/trunk/ext/enchant/enchant.c     2011-10-01 13:01:12 UTC (rev 
317599)
@@ -244,8 +244,8 @@
                        if (broker->pbroker) {
                                if (broker->dictcnt && broker->dict) {
                                        if (broker->dict) {
-                                               int total, tofree;
-                                               tofree = total = 
broker->dictcnt-1;
+                                               int total;
+                                               total = broker->dictcnt-1;
                                                do {
                                                        
zend_list_delete(broker->dict[total]->rsrc_id);
                                                        
efree(broker->dict[total]);
@@ -357,8 +357,8 @@
        enchant_broker *broker;
        EnchantBroker *pbroker;

-       if (ZEND_NUM_ARGS()) {
-               ZEND_WRONG_PARAM_COUNT();
+       if (zend_parse_parameters_none() == FAILURE) {
+               return;
        }

        pbroker = enchant_broker_init();
@@ -542,6 +542,11 @@
        }

        PHP_ENCHANT_GET_BROKER;
+
+       if (taglen == 0) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tag cannot be 
empty");
+               RETURN_FALSE;
+       }

        d = enchant_broker_request_dict(pbroker->pbroker, (const char *)tag);
        if (d) {

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

Reply via email to