mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Avoid unnecessary destruction in bc_mul()
This commit is contained in:
parent
0cd952d851
commit
34b2116eb5
8 changed files with 21 additions and 18 deletions
|
@ -242,7 +242,7 @@ PHP_FUNCTION(bcmul)
|
|||
zend_string *left, *right;
|
||||
zend_long scale_param;
|
||||
bool scale_param_is_null = 1;
|
||||
bc_num first = NULL, second = NULL, result;
|
||||
bc_num first = NULL, second = NULL, result = NULL;
|
||||
int scale;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(2, 3)
|
||||
|
@ -261,8 +261,6 @@ PHP_FUNCTION(bcmul)
|
|||
scale = (int) scale_param;
|
||||
}
|
||||
|
||||
bc_init_num(&result);
|
||||
|
||||
if (php_str2num(&first, ZSTR_VAL(left)) == FAILURE) {
|
||||
zend_argument_value_error(1, "is not well-formed");
|
||||
goto cleanup;
|
||||
|
@ -273,7 +271,7 @@ PHP_FUNCTION(bcmul)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
bc_multiply (first, second, &result, scale);
|
||||
result = bc_multiply (first, second, scale);
|
||||
|
||||
RETVAL_NEW_STR(bc_num2str_ex(result, scale));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue