Skip to content

Commit

Permalink
Move bcmath_check_scale()
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsdos committed Sep 7, 2024
1 parent f1b4e12 commit 2e88916
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ext/bcmath/bcmath.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ PHP_MINFO_FUNCTION(bcmath)
}
/* }}} */

static zend_always_inline zend_result bcmath_check_scale(zend_long scale, uint32_t arg_num)
{
if (UNEXPECTED(scale < 0 || scale > INT_MAX)) {
zend_argument_value_error(arg_num, "must be between 0 and %d", INT_MAX);
return FAILURE;
}
return SUCCESS;
}

static void php_long2num(bc_num *num, zend_long lval)
{
*num = bc_long2num(lval);
Expand Down Expand Up @@ -1305,15 +1314,6 @@ static zend_always_inline zend_result bc_num_from_obj_or_str_or_long_with_err(
return SUCCESS;
}

static zend_always_inline zend_result bcmath_check_scale(zend_long scale, uint32_t arg_num)
{
if (UNEXPECTED(scale < 0 || scale > INT_MAX)) {
zend_argument_value_error(arg_num, "must be between 0 and %d", INT_MAX);
return FAILURE;
}
return SUCCESS;
}

PHP_METHOD(BcMath_Number, __construct)
{
zend_string *str = NULL;
Expand Down

0 comments on commit 2e88916

Please sign in to comment.