mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Avoid uninitialized variable warnings in gmp
This commit is contained in:
parent
733c61a894
commit
3d9c48035b
1 changed files with 6 additions and 9 deletions
|
@ -828,13 +828,12 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg) /* {{{ */
|
||||||
static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op_t gmp_op, gmp_binary_ui_op_t gmp_ui_op, int check_b_zero)
|
static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op_t gmp_op, gmp_binary_ui_op_t gmp_ui_op, int check_b_zero)
|
||||||
{
|
{
|
||||||
mpz_ptr gmpnum_a, gmpnum_b, gmpnum_result;
|
mpz_ptr gmpnum_a, gmpnum_b, gmpnum_result;
|
||||||
int use_ui = 0;
|
|
||||||
gmp_temp_t temp_a, temp_b;
|
gmp_temp_t temp_a, temp_b;
|
||||||
|
|
||||||
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
|
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
|
||||||
|
|
||||||
if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_LONG && Z_LVAL_P(b_arg) >= 0) {
|
if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_LONG && Z_LVAL_P(b_arg) >= 0) {
|
||||||
use_ui = 1;
|
gmpnum_b = NULL;
|
||||||
temp_b.is_used = 0;
|
temp_b.is_used = 0;
|
||||||
} else {
|
} else {
|
||||||
FETCH_GMP_ZVAL_DEP(gmpnum_b, b_arg, temp_b, temp_a);
|
FETCH_GMP_ZVAL_DEP(gmpnum_b, b_arg, temp_b, temp_a);
|
||||||
|
@ -842,7 +841,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *
|
||||||
|
|
||||||
if (check_b_zero) {
|
if (check_b_zero) {
|
||||||
int b_is_zero = 0;
|
int b_is_zero = 0;
|
||||||
if (use_ui) {
|
if (!gmpnum_b) {
|
||||||
b_is_zero = (Z_LVAL_P(b_arg) == 0);
|
b_is_zero = (Z_LVAL_P(b_arg) == 0);
|
||||||
} else {
|
} else {
|
||||||
b_is_zero = !mpz_cmp_ui(gmpnum_b, 0);
|
b_is_zero = !mpz_cmp_ui(gmpnum_b, 0);
|
||||||
|
@ -858,7 +857,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *
|
||||||
|
|
||||||
INIT_GMP_RETVAL(gmpnum_result);
|
INIT_GMP_RETVAL(gmpnum_result);
|
||||||
|
|
||||||
if (use_ui) {
|
if (!gmpnum_b) {
|
||||||
gmp_ui_op(gmpnum_result, gmpnum_a, (gmp_ulong) Z_LVAL_P(b_arg));
|
gmp_ui_op(gmpnum_result, gmpnum_a, (gmp_ulong) Z_LVAL_P(b_arg));
|
||||||
} else {
|
} else {
|
||||||
gmp_op(gmpnum_result, gmpnum_a, gmpnum_b);
|
gmp_op(gmpnum_result, gmpnum_a, gmpnum_b);
|
||||||
|
@ -875,15 +874,13 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *
|
||||||
static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op2_t gmp_op, gmp_binary_ui_op2_t gmp_ui_op, int check_b_zero)
|
static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op2_t gmp_op, gmp_binary_ui_op2_t gmp_ui_op, int check_b_zero)
|
||||||
{
|
{
|
||||||
mpz_ptr gmpnum_a, gmpnum_b, gmpnum_result1, gmpnum_result2;
|
mpz_ptr gmpnum_a, gmpnum_b, gmpnum_result1, gmpnum_result2;
|
||||||
int use_ui = 0;
|
|
||||||
gmp_temp_t temp_a, temp_b;
|
gmp_temp_t temp_a, temp_b;
|
||||||
zval result1, result2;
|
zval result1, result2;
|
||||||
|
|
||||||
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
|
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
|
||||||
|
|
||||||
if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_LONG && Z_LVAL_P(b_arg) >= 0) {
|
if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_LONG && Z_LVAL_P(b_arg) >= 0) {
|
||||||
/* use _ui function */
|
gmpnum_b = NULL;
|
||||||
use_ui = 1;
|
|
||||||
temp_b.is_used = 0;
|
temp_b.is_used = 0;
|
||||||
} else {
|
} else {
|
||||||
FETCH_GMP_ZVAL_DEP(gmpnum_b, b_arg, temp_b, temp_a);
|
FETCH_GMP_ZVAL_DEP(gmpnum_b, b_arg, temp_b, temp_a);
|
||||||
|
@ -891,7 +888,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval
|
||||||
|
|
||||||
if (check_b_zero) {
|
if (check_b_zero) {
|
||||||
int b_is_zero = 0;
|
int b_is_zero = 0;
|
||||||
if (use_ui) {
|
if (!gmpnum_b) {
|
||||||
b_is_zero = (Z_LVAL_P(b_arg) == 0);
|
b_is_zero = (Z_LVAL_P(b_arg) == 0);
|
||||||
} else {
|
} else {
|
||||||
b_is_zero = !mpz_cmp_ui(gmpnum_b, 0);
|
b_is_zero = !mpz_cmp_ui(gmpnum_b, 0);
|
||||||
|
@ -912,7 +909,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval
|
||||||
add_next_index_zval(return_value, &result1);
|
add_next_index_zval(return_value, &result1);
|
||||||
add_next_index_zval(return_value, &result2);
|
add_next_index_zval(return_value, &result2);
|
||||||
|
|
||||||
if (use_ui) {
|
if (!gmpnum_b) {
|
||||||
gmp_ui_op(gmpnum_result1, gmpnum_result2, gmpnum_a, (gmp_ulong) Z_LVAL_P(b_arg));
|
gmp_ui_op(gmpnum_result1, gmpnum_result2, gmpnum_a, (gmp_ulong) Z_LVAL_P(b_arg));
|
||||||
} else {
|
} else {
|
||||||
gmp_op(gmpnum_result1, gmpnum_result2, gmpnum_a, gmpnum_b);
|
gmp_op(gmpnum_result1, gmpnum_result2, gmpnum_a, gmpnum_b);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue