iliaa Sat Jan 18 14:53:34 2003 EDT Modified files: /php4/ext/wddx wddx.c /php4/ext/yaz php_yaz.c Log: Removed pointless memory allocation checks. Changed php_error to php_error_docref. Index: php4/ext/wddx/wddx.c diff -u php4/ext/wddx/wddx.c:1.97 php4/ext/wddx/wddx.c:1.98 --- php4/ext/wddx/wddx.c:1.97 Tue Dec 31 11:08:06 2002 +++ php4/ext/wddx/wddx.c Sat Jan 18 14:53:33 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: wddx.c,v 1.97 2002/12/31 16:08:06 sebastian Exp $ */ +/* $Id: wddx.c,v 1.98 2003/01/18 19:53:33 iliaa Exp $ */ #include "php.h" #include "php_wddx.h" @@ -136,14 +136,11 @@ { stack->top = 0; stack->elements = (void **) emalloc(sizeof(void **) * STACK_BLOCK_SIZE); - if (!stack->elements) { - return FAILURE; - } else { - stack->max = STACK_BLOCK_SIZE; - stack->varname = NULL; - stack->done = 0; - return SUCCESS; - } + stack->max = STACK_BLOCK_SIZE; + stack->varname = NULL; + stack->done = 0; + + return SUCCESS; } /* }}} */ @@ -154,9 +151,6 @@ if (stack->top >= stack->max) { /* we need to allocate more memory */ stack->elements = (void **) erealloc(stack->elements, (sizeof(void **) * (stack->max += STACK_BLOCK_SIZE))); - if (!stack->elements) { - return FAILURE; - } } stack->elements[stack->top] = (void *) emalloc(size); memcpy(stack->elements[stack->top], element, size); @@ -490,7 +484,7 @@ zend_hash_get_current_data(HASH_OF(retval), (void **)&varname) == SUCCESS; zend_hash_move_forward(HASH_OF(retval))) { if (Z_TYPE_PP(varname) != IS_STRING) { - php_error(E_NOTICE, "__sleep should return an array only containing the names of instance-variables to serialize."); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, +"__sleep should return an array only containing the names of instance-variables to +serialize."); continue; } @@ -1133,9 +1127,7 @@ argc = ZEND_NUM_ARGS(); if (argc < 1) { - php_error(E_WARNING, "%s() requires at least 1 argument, 0 given", - get_active_function_name(TSRMLS_C)); - return; + WRONG_PARAM_COUNT; } /* Allocate arguments array and get the arguments, checking for errors. */ @@ -1250,9 +1242,7 @@ argc = ZEND_NUM_ARGS(); if (argc < 2) { - php_error(E_WARNING, "%s() requires at least 2 arguments, %d given", - get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); - return; + WRONG_PARAM_COUNT; } /* Allocate arguments array and get the arguments, checking for errors. */ Index: php4/ext/yaz/php_yaz.c diff -u php4/ext/yaz/php_yaz.c:1.61 php4/ext/yaz/php_yaz.c:1.62 --- php4/ext/yaz/php_yaz.c:1.61 Wed Jan 15 03:00:41 2003 +++ php4/ext/yaz/php_yaz.c Sat Jan 18 14:53:33 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_yaz.c,v 1.61 2003/01/15 08:00:41 dickmeiss Exp $ */ +/* $Id: php_yaz.c,v 1.62 2003/01/18 19:53:33 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -162,7 +162,7 @@ #ifdef ZTS tsrm_mutex_unlock (yaz_mutex); #endif - php_error(E_WARNING, "Invalid YAZ handle"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid YAZ handle"); } } @@ -518,7 +518,7 @@ } if (Z_TYPE_PP(pval_options) != IS_ARRAY) { - php_error(E_WARNING, "yaz_wait: Expected array parameter"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array +parameter"); RETURN_FALSE; } options_ht = Z_ARRVAL_PP(pval_options); @@ -827,10 +827,7 @@ int eno[20]; int level = 0; - if (array_init(return_value) == FAILURE) - { - RETURN_FALSE; - } + array_init(return_value); eno[level] = 0; grs[level] = p; while (level >= 0) @@ -1201,7 +1198,7 @@ } if (Z_TYPE_PP(pval_package) != IS_ARRAY) { - php_error(E_WARNING, "yaz_itemorder: Expected array parameter"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array +parameter"); RETURN_FALSE; } get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); @@ -1247,7 +1244,7 @@ } if (Z_TYPE_PP(pval_flags) != IS_ARRAY) { - php_error(E_WARNING, "yaz_scan: Bad flags parameter"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad flags +parameter"); RETURN_FALSE; } flags_ht = Z_ARRVAL_PP(pval_flags); @@ -1290,10 +1287,7 @@ { WRONG_PARAM_COUNT; } - if (array_init(return_value) == FAILURE) - { - RETURN_FALSE; - } + array_init(return_value); get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); if (p && p->zoom_package) { @@ -1331,10 +1325,7 @@ { WRONG_PARAM_COUNT; } - if (array_init(return_value) == FAILURE) - { - RETURN_FALSE; - } + array_init(return_value); if (pval_opt && array_init(*pval_opt) == FAILURE) { RETURN_FALSE; @@ -1404,7 +1395,7 @@ } if (Z_TYPE_PP(pval_package) != IS_ARRAY) { - php_error(E_WARNING, "yaz_ccl_conf: Expected array parameter"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array +parameter"); RETURN_FALSE; } get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); @@ -1453,11 +1444,7 @@ } pval_destructor(*pval_res); - if (array_init(*pval_res) == FAILURE) - { - php_error(E_WARNING, "cannot initialize array"); - RETURN_FALSE; - } + array_init(*pval_res); convert_to_string_ex (pval_query); get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); if (p)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php