Skip to content

Commit 66d25f5

Browse files
committed
- Improve void arg check
- Removed unused variable - Added check for empty tag in enchant_broker_request_dict() (to avoid assert warning)
1 parent 50662f8 commit 66d25f5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

ext/enchant/enchant.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{
244244
if (broker->pbroker) {
245245
if (broker->dictcnt && broker->dict) {
246246
if (broker->dict) {
247-
int total, tofree;
248-
tofree = total = broker->dictcnt-1;
247+
int total;
248+
total = broker->dictcnt-1;
249249
do {
250250
zend_list_delete(broker->dict[total]->rsrc_id);
251251
efree(broker->dict[total]);
@@ -357,8 +357,8 @@ PHP_FUNCTION(enchant_broker_init)
357357
enchant_broker *broker;
358358
EnchantBroker *pbroker;
359359

360-
if (ZEND_NUM_ARGS()) {
361-
ZEND_WRONG_PARAM_COUNT();
360+
if (zend_parse_parameters_none() == FAILURE) {
361+
return;
362362
}
363363

364364
pbroker = enchant_broker_init();
@@ -542,6 +542,11 @@ PHP_FUNCTION(enchant_broker_request_dict)
542542
}
543543

544544
PHP_ENCHANT_GET_BROKER;
545+
546+
if (taglen == 0) {
547+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tag cannot be empty");
548+
RETURN_FALSE;
549+
}
545550

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

0 commit comments

Comments
 (0)