diff options
Diffstat (limited to 'ext/gmp/gmp.c')
-rw-r--r-- | ext/gmp/gmp.c | 308 |
1 files changed, 154 insertions, 154 deletions
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 5d1d1e689e..beb016d84f 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -246,7 +246,7 @@ typedef struct _gmp_temp { #define GMP_MAX_BASE 62 #define IS_GMP(zval) \ - (Z_TYPE_P(zval) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zval), gmp_ce TSRMLS_CC)) + (Z_TYPE_P(zval) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zval), gmp_ce)) #define GET_GMP_OBJECT_FROM_OBJ(obj) \ ((gmp_object *) ((char *) (obj) - XtOffsetOf(gmp_object, std))) @@ -286,7 +286,7 @@ if (IS_GMP(zval)) { \ temp.is_used = 0; \ } else { \ mpz_init(temp.num); \ - if (convert_to_gmp(temp.num, zval, 0 TSRMLS_CC) == FAILURE) { \ + if (convert_to_gmp(temp.num, zval, 0) == FAILURE) { \ mpz_clear(temp.num); \ FREE_GMP_TEMP(dep1); \ FREE_GMP_TEMP(dep2); \ @@ -302,7 +302,7 @@ if (IS_GMP(zval)) { \ temp.is_used = 0; \ } else { \ mpz_init(temp.num); \ - if (convert_to_gmp(temp.num, zval, 0 TSRMLS_CC) == FAILURE) { \ + if (convert_to_gmp(temp.num, zval, 0) == FAILURE) { \ mpz_clear(temp.num); \ FREE_GMP_TEMP(dep); \ RETURN_FALSE; \ @@ -317,7 +317,7 @@ if (IS_GMP(zval)) { \ temp.is_used = 0; \ } else { \ mpz_init(temp.num); \ - if (convert_to_gmp(temp.num, zval, 0 TSRMLS_CC) == FAILURE) { \ + if (convert_to_gmp(temp.num, zval, 0) == FAILURE) { \ mpz_clear(temp.num); \ RETURN_FALSE; \ } \ @@ -326,11 +326,11 @@ if (IS_GMP(zval)) { \ } #define INIT_GMP_RETVAL(gmpnumber) \ - gmp_create(return_value, &gmpnumber TSRMLS_CC) + gmp_create(return_value, &gmpnumber) static void gmp_strval(zval *result, mpz_t gmpnum, zend_long base); -static int convert_to_gmp(mpz_t gmpnumber, zval *val, zend_long base TSRMLS_DC); -static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC); +static int convert_to_gmp(mpz_t gmpnumber, zval *val, zend_long base); +static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg); /* * The gmp_*_op functions provide an implementation for several common types @@ -350,10 +350,10 @@ typedef void (*gmp_binary_ui_op_t)(mpz_ptr, mpz_srcptr, gmp_ulong); typedef void (*gmp_binary_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr); typedef void (*gmp_binary_ui_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, gmp_ulong); -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 TSRMLS_DC); -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 TSRMLS_DC); -static inline void gmp_zval_unary_op(zval *return_value, zval *a_arg, gmp_unary_op_t gmp_op TSRMLS_DC); -static inline void gmp_zval_unary_ui_op(zval *return_value, zval *a_arg, gmp_unary_ui_op_t gmp_op TSRMLS_DC); +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_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_unary_op(zval *return_value, zval *a_arg, gmp_unary_op_t gmp_op); +static inline void gmp_zval_unary_ui_op(zval *return_value, zval *a_arg, gmp_unary_ui_op_t gmp_op); /* Binary operations */ #define gmp_binary_ui_op(op, uop) _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAM_PASSTHRU, op, uop, 0) @@ -367,21 +367,21 @@ static inline void gmp_zval_unary_ui_op(zval *return_value, zval *a_arg, gmp_una #define gmp_unary_opl(op) _gmp_unary_opl(INTERNAL_FUNCTION_PARAM_PASSTHRU, op) #define gmp_unary_ui_op(op) _gmp_unary_ui_op(INTERNAL_FUNCTION_PARAM_PASSTHRU, op) -static void gmp_free_object_storage(zend_object *obj TSRMLS_DC) /* {{{ */ +static void gmp_free_object_storage(zend_object *obj) /* {{{ */ { gmp_object *intern = GET_GMP_OBJECT_FROM_OBJ(obj); mpz_clear(intern->num); - zend_object_std_dtor(&intern->std TSRMLS_CC); + zend_object_std_dtor(&intern->std); } /* }}} */ -static inline zend_object *gmp_create_object_ex(zend_class_entry *ce, mpz_ptr *gmpnum_target TSRMLS_DC) /* {{{ */ +static inline zend_object *gmp_create_object_ex(zend_class_entry *ce, mpz_ptr *gmpnum_target) /* {{{ */ { gmp_object *intern = emalloc(sizeof(gmp_object) + sizeof(zval) * (ce->default_properties_count - 1)); - zend_object_std_init(&intern->std, ce TSRMLS_CC); + zend_object_std_init(&intern->std, ce); object_properties_init(&intern->std, ce); mpz_init(intern->num); @@ -392,20 +392,20 @@ static inline zend_object *gmp_create_object_ex(zend_class_entry *ce, mpz_ptr *g } /* }}} */ -static zend_object *gmp_create_object(zend_class_entry *ce TSRMLS_DC) /* {{{ */ +static zend_object *gmp_create_object(zend_class_entry *ce) /* {{{ */ { mpz_ptr gmpnum_dummy; - return gmp_create_object_ex(ce, &gmpnum_dummy TSRMLS_CC); + return gmp_create_object_ex(ce, &gmpnum_dummy); } /* }}} */ -static inline void gmp_create(zval *target, mpz_ptr *gmpnum_target TSRMLS_DC) /* {{{ */ +static inline void gmp_create(zval *target, mpz_ptr *gmpnum_target) /* {{{ */ { - ZVAL_OBJ(target, gmp_create_object_ex(gmp_ce, gmpnum_target TSRMLS_CC)); + ZVAL_OBJ(target, gmp_create_object_ex(gmp_ce, gmpnum_target)); } /* }}} */ -static int gmp_cast_object(zval *readobj, zval *writeobj, int type TSRMLS_DC) /* {{{ */ +static int gmp_cast_object(zval *readobj, zval *writeobj, int type) /* {{{ */ { mpz_ptr gmpnum; switch (type) { @@ -427,9 +427,9 @@ static int gmp_cast_object(zval *readobj, zval *writeobj, int type TSRMLS_DC) /* } /* }}} */ -static HashTable *gmp_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* {{{ */ +static HashTable *gmp_get_debug_info(zval *obj, int *is_temp) /* {{{ */ { - HashTable *ht, *props = zend_std_get_properties(obj TSRMLS_CC); + HashTable *ht, *props = zend_std_get_properties(obj); mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(obj); zval zv; @@ -444,12 +444,12 @@ static HashTable *gmp_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* {{{ * } /* }}} */ -static zend_object *gmp_clone_obj(zval *obj TSRMLS_DC) /* {{{ */ +static zend_object *gmp_clone_obj(zval *obj) /* {{{ */ { gmp_object *old_object = GET_GMP_OBJECT_FROM_ZVAL(obj); - gmp_object *new_object = GET_GMP_OBJECT_FROM_OBJ(gmp_create_object(Z_OBJCE_P(obj) TSRMLS_CC)); + gmp_object *new_object = GET_GMP_OBJECT_FROM_OBJ(gmp_create_object(Z_OBJCE_P(obj))); - zend_objects_clone_members( &new_object->std, &old_object->std TSRMLS_CC); + zend_objects_clone_members( &new_object->std, &old_object->std); mpz_set(new_object->num, old_object->num); @@ -457,11 +457,11 @@ static zend_object *gmp_clone_obj(zval *obj TSRMLS_DC) /* {{{ */ } /* }}} */ -static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zval *op1, zval *op2 TSRMLS_DC) { +static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zval *op1, zval *op2) { zend_long shift = zval_get_long(op2); if (shift < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Shift cannot be negative"); + php_error_docref(NULL, E_WARNING, "Shift cannot be negative"); RETVAL_FALSE; } else { mpz_ptr gmpnum_op, gmpnum_result; @@ -485,10 +485,10 @@ static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zva #define DO_BINARY_OP(op) DO_BINARY_UI_OP_EX(op, NULL, 0) #define DO_UNARY_OP(op) \ - gmp_zval_unary_op(result, op1, op TSRMLS_CC); \ + gmp_zval_unary_op(result, op1, op); \ return SUCCESS; -static int gmp_do_operation_ex(zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ +static int gmp_do_operation_ex(zend_uchar opcode, zval *result, zval *op1, zval *op2) /* {{{ */ { switch (opcode) { case ZEND_ADD: @@ -498,17 +498,17 @@ static int gmp_do_operation_ex(zend_uchar opcode, zval *result, zval *op1, zval case ZEND_MUL: DO_BINARY_UI_OP(mpz_mul); case ZEND_POW: - shift_operator_helper(mpz_pow_ui, result, op1, op2 TSRMLS_CC); + shift_operator_helper(mpz_pow_ui, result, op1, op2); return SUCCESS; case ZEND_DIV: DO_BINARY_UI_OP_EX(mpz_tdiv_q, mpz_tdiv_q_ui, 1); case ZEND_MOD: DO_BINARY_UI_OP_EX(mpz_mod, mpz_mod_ui, 1); case ZEND_SL: - shift_operator_helper(mpz_mul_2exp, result, op1, op2 TSRMLS_CC); + shift_operator_helper(mpz_mul_2exp, result, op1, op2); return SUCCESS; case ZEND_SR: - shift_operator_helper(mpz_fdiv_q_2exp, result, op1, op2 TSRMLS_CC); + shift_operator_helper(mpz_fdiv_q_2exp, result, op1, op2); return SUCCESS; case ZEND_BW_OR: DO_BINARY_OP(mpz_ior); @@ -525,7 +525,7 @@ static int gmp_do_operation_ex(zend_uchar opcode, zval *result, zval *op1, zval } /* }}} */ -static int gmp_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ +static int gmp_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op2) /* {{{ */ { zval op1_copy; int retval; @@ -535,7 +535,7 @@ static int gmp_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op op1 = &op1_copy; } - retval = gmp_do_operation_ex(opcode, result, op1, op2 TSRMLS_CC); + retval = gmp_do_operation_ex(opcode, result, op1, op2); if (retval == SUCCESS && op1 == &op1_copy) { zval_dtor(op1); @@ -545,9 +545,9 @@ static int gmp_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op } /* }}} */ -static int gmp_compare(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ +static int gmp_compare(zval *result, zval *op1, zval *op2) /* {{{ */ { - gmp_cmp(result, op1, op2 TSRMLS_CC); + gmp_cmp(result, op1, op2); if (Z_TYPE_P(result) == IS_FALSE) { ZVAL_LONG(result, 1); } @@ -555,7 +555,7 @@ static int gmp_compare(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ } /* }}} */ -static int gmp_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */ +static int gmp_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) /* {{{ */ { mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(object); smart_str buf = {0}; @@ -566,12 +566,12 @@ static int gmp_serialize(zval *object, unsigned char **buffer, size_t *buf_len, PHP_VAR_SERIALIZE_INIT(serialize_data); gmp_strval(&zv, gmpnum, 10); - php_var_serialize(&buf, &zv, &serialize_data TSRMLS_CC); + php_var_serialize(&buf, &zv, &serialize_data); zval_dtor(&zv); ZVAL_ARR(&zv, &tmp_arr); - tmp_arr.ht = *zend_std_get_properties(object TSRMLS_CC); - php_var_serialize(&buf, &zv, &serialize_data TSRMLS_CC); + tmp_arr.ht = *zend_std_get_properties(object); + php_var_serialize(&buf, &zv, &serialize_data); PHP_VAR_SERIALIZE_DESTROY(serialize_data); *buffer = (unsigned char *) estrndup(buf.s->val, buf.s->len); @@ -582,7 +582,7 @@ static int gmp_serialize(zval *object, unsigned char **buffer, size_t *buf_len, } /* }}} */ -static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */ +static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data) /* {{{ */ { mpz_ptr gmpnum; const unsigned char *p, *max; @@ -592,31 +592,31 @@ static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned ch ZVAL_UNDEF(&zv); PHP_VAR_UNSERIALIZE_INIT(unserialize_data); - gmp_create(object, &gmpnum TSRMLS_CC); + gmp_create(object, &gmpnum); p = buf; max = buf + buf_len; - if (!php_var_unserialize(&zv, &p, max, &unserialize_data TSRMLS_CC) + if (!php_var_unserialize(&zv, &p, max, &unserialize_data) || Z_TYPE(zv) != IS_STRING - || convert_to_gmp(gmpnum, &zv, 10 TSRMLS_CC) == FAILURE + || convert_to_gmp(gmpnum, &zv, 10) == FAILURE ) { - zend_throw_exception(NULL, "Could not unserialize number", 0 TSRMLS_CC); + zend_throw_exception(NULL, "Could not unserialize number", 0); goto exit; } zval_dtor(&zv); ZVAL_UNDEF(&zv); - if (!php_var_unserialize(&zv, &p, max, &unserialize_data TSRMLS_CC) + if (!php_var_unserialize(&zv, &p, max, &unserialize_data) || Z_TYPE(zv) != IS_ARRAY ) { - zend_throw_exception(NULL, "Could not unserialize properties", 0 TSRMLS_CC); + zend_throw_exception(NULL, "Could not unserialize properties", 0); goto exit; } if (zend_hash_num_elements(Z_ARRVAL(zv)) != 0) { zend_hash_copy( - zend_std_get_properties(object TSRMLS_CC), Z_ARRVAL(zv), + zend_std_get_properties(object), Z_ARRVAL(zv), (copy_ctor_func_t) zval_add_ref ); } @@ -646,7 +646,7 @@ ZEND_MINIT_FUNCTION(gmp) { zend_class_entry tmp_ce; INIT_CLASS_ENTRY(tmp_ce, "GMP", NULL); - gmp_ce = zend_register_internal_class(&tmp_ce TSRMLS_CC); + gmp_ce = zend_register_internal_class(&tmp_ce); gmp_ce->create_object = gmp_create_object; gmp_ce->serialize = gmp_serialize; gmp_ce->unserialize = gmp_unserialize; @@ -709,7 +709,7 @@ ZEND_MODULE_INFO_D(gmp) /* {{{ convert_to_gmp * Convert zval to be gmp number */ -static int convert_to_gmp(mpz_t gmpnumber, zval *val, zend_long base TSRMLS_DC) +static int convert_to_gmp(mpz_t gmpnumber, zval *val, zend_long base) { switch (Z_TYPE_P(val)) { case IS_LONG: @@ -735,7 +735,7 @@ static int convert_to_gmp(mpz_t gmpnumber, zval *val, zend_long base TSRMLS_DC) ret = mpz_set_str(gmpnumber, (skip_lead ? &numstr[2] : numstr), (int) base); if (-1 == ret) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "Unable to convert variable to GMP - string is not an integer"); return FAILURE; } @@ -743,7 +743,7 @@ static int convert_to_gmp(mpz_t gmpnumber, zval *val, zend_long base TSRMLS_DC) return SUCCESS; } default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "Unable to convert variable to GMP - wrong type"); return FAILURE; } @@ -781,7 +781,7 @@ static void gmp_strval(zval *result, mpz_t gmpnum, zend_long base) /* {{{ */ } /* }}} */ -static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* {{{ */ +static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg) /* {{{ */ { mpz_ptr gmpnum_a, gmpnum_b; gmp_temp_t temp_a, temp_b; @@ -813,7 +813,7 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* { /* {{{ gmp_zval_binary_ui_op Execute GMP binary operation. */ -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 TSRMLS_DC) +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; int use_ui = 0; @@ -837,7 +837,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval * } if (b_is_zero) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Zero operand not allowed"); + php_error_docref(NULL, E_WARNING, "Zero operand not allowed"); FREE_GMP_TEMP(temp_a); FREE_GMP_TEMP(temp_b); RETURN_FALSE; @@ -860,7 +860,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval * /* {{{ gmp_zval_binary_ui_op2 Execute GMP binary operation which returns 2 values. */ -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 TSRMLS_DC) +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; int use_ui = 0; @@ -886,15 +886,15 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval } if (b_is_zero) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Zero operand not allowed"); + php_error_docref(NULL, E_WARNING, "Zero operand not allowed"); FREE_GMP_TEMP(temp_a); FREE_GMP_TEMP(temp_b); RETURN_FALSE; } } - gmp_create(&result1, &gmpnum_result1 TSRMLS_CC); - gmp_create(&result2, &gmpnum_result2 TSRMLS_CC); + gmp_create(&result1, &gmpnum_result1); + gmp_create(&result2, &gmpnum_result2); array_init(return_value); add_next_index_zval(return_value, &result1); @@ -917,11 +917,11 @@ static inline void _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_op { zval *a_arg, *b_arg; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &a_arg, &b_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){ return; } - gmp_zval_binary_ui_op(return_value, a_arg, b_arg, gmp_op, gmp_ui_op, check_b_zero TSRMLS_CC); + gmp_zval_binary_ui_op(return_value, a_arg, b_arg, gmp_op, gmp_ui_op, check_b_zero); } /* }}} */ @@ -929,7 +929,7 @@ static inline void _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_op /* {{{ gmp_zval_unary_op */ -static inline void gmp_zval_unary_op(zval *return_value, zval *a_arg, gmp_unary_op_t gmp_op TSRMLS_DC) +static inline void gmp_zval_unary_op(zval *return_value, zval *a_arg, gmp_unary_op_t gmp_op) { mpz_ptr gmpnum_a, gmpnum_result; gmp_temp_t temp_a; @@ -945,7 +945,7 @@ static inline void gmp_zval_unary_op(zval *return_value, zval *a_arg, gmp_unary_ /* {{{ gmp_zval_unary_ui_op */ -static inline void gmp_zval_unary_ui_op(zval *return_value, zval *a_arg, gmp_unary_ui_op_t gmp_op TSRMLS_DC) +static inline void gmp_zval_unary_ui_op(zval *return_value, zval *a_arg, gmp_unary_ui_op_t gmp_op) { mpz_ptr gmpnum_result; @@ -961,11 +961,11 @@ static inline void _gmp_unary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_ui_o { zval *a_arg; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){ return; } - gmp_zval_unary_ui_op(return_value, a_arg, gmp_op TSRMLS_CC); + gmp_zval_unary_ui_op(return_value, a_arg, gmp_op); } /* }}} */ @@ -975,11 +975,11 @@ static inline void _gmp_unary_op(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_op_t gm { zval *a_arg; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){ return; } - gmp_zval_unary_op(return_value, a_arg, gmp_op TSRMLS_CC); + gmp_zval_unary_op(return_value, a_arg, gmp_op); } /* }}} */ @@ -991,7 +991,7 @@ static inline void _gmp_unary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_opl_t mpz_ptr gmpnum_a; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){ return; } @@ -1009,7 +1009,7 @@ static inline void _gmp_binary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_opl_ mpz_ptr gmpnum_a, gmpnum_b; gmp_temp_t temp_a, temp_b; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &a_arg, &b_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){ return; } @@ -1031,27 +1031,27 @@ ZEND_FUNCTION(gmp_init) mpz_ptr gmpnumber; zend_long base = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &number_arg, &base) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &number_arg, &base) == FAILURE) { return; } if (base && (base < 2 || base > GMP_MAX_BASE)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %pd (should be between 2 and %d)", base, GMP_MAX_BASE); + php_error_docref(NULL, E_WARNING, "Bad base for conversion: %pd (should be between 2 and %d)", base, GMP_MAX_BASE); RETURN_FALSE; } INIT_GMP_RETVAL(gmpnumber); - if (convert_to_gmp(gmpnumber, number_arg, base TSRMLS_CC) == FAILURE) { + if (convert_to_gmp(gmpnumber, number_arg, base) == FAILURE) { zval_dtor(return_value); RETURN_FALSE; } } /* }}} */ -int gmp_import_export_validate(zend_long size, zend_long options, int *order, int *endian TSRMLS_DC) +int gmp_import_export_validate(zend_long size, zend_long options, int *order, int *endian) { if (size < 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "Word size must be positive, %pd given", size); return FAILURE; } @@ -1065,7 +1065,7 @@ int gmp_import_export_validate(zend_long size, zend_long options, int *order, in *order = 1; break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "Invalid options: Conflicting word orders"); return FAILURE; } @@ -1082,7 +1082,7 @@ int gmp_import_export_validate(zend_long size, zend_long options, int *order, in *endian = 0; break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "Invalid options: Conflicting word endianness"); return FAILURE; } @@ -1101,16 +1101,16 @@ ZEND_FUNCTION(gmp_import) int order, endian; mpz_ptr gmpnumber; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &data, &data_len, &size, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ll", &data, &data_len, &size, &options) == FAILURE) { return; } - if (gmp_import_export_validate(size, options, &order, &endian TSRMLS_CC) == FAILURE) { + if (gmp_import_export_validate(size, options, &order, &endian) == FAILURE) { RETURN_FALSE; } if ((data_len % size) != 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "Input length must be a multiple of word size"); RETURN_FALSE; } @@ -1132,11 +1132,11 @@ ZEND_FUNCTION(gmp_export) mpz_ptr gmpnumber; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &gmpnumber_arg, &size, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|ll", &gmpnumber_arg, &size, &options) == FAILURE) { return; } - if (gmp_import_export_validate(size, options, &order, &endian TSRMLS_CC) == FAILURE) { + if (gmp_import_export_validate(size, options, &order, &endian) == FAILURE) { RETURN_FALSE; } @@ -1166,7 +1166,7 @@ ZEND_FUNCTION(gmp_intval) { zval *gmpnumber_arg; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &gmpnumber_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &gmpnumber_arg) == FAILURE){ return; } @@ -1187,14 +1187,14 @@ ZEND_FUNCTION(gmp_strval) mpz_ptr gmpnum; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &gmpnumber_arg, &base) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &gmpnumber_arg, &base) == FAILURE) { return; } /* Although the maximum base in general in GMP is 62, mpz_get_str() * is explicitly limited to -36 when dealing with negative bases. */ if ((base < 2 && base > -2) || base > GMP_MAX_BASE || base < -36) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %pd (should be between 2 and %d or -2 and -36)", base, GMP_MAX_BASE); + php_error_docref(NULL, E_WARNING, "Bad base for conversion: %pd (should be between 2 and %d or -2 and -36)", base, GMP_MAX_BASE); RETURN_FALSE; } @@ -1237,22 +1237,22 @@ ZEND_FUNCTION(gmp_div_qr) zval *a_arg, *b_arg; zend_long round = GMP_ROUND_ZERO; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &a_arg, &b_arg, &round) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|l", &a_arg, &b_arg, &round) == FAILURE) { return; } switch (round) { case GMP_ROUND_ZERO: - gmp_zval_binary_ui_op2(return_value, a_arg, b_arg, mpz_tdiv_qr, (gmp_binary_ui_op2_t) mpz_tdiv_qr_ui, 1 TSRMLS_CC); + gmp_zval_binary_ui_op2(return_value, a_arg, b_arg, mpz_tdiv_qr, (gmp_binary_ui_op2_t) mpz_tdiv_qr_ui, 1); break; case GMP_ROUND_PLUSINF: - gmp_zval_binary_ui_op2(return_value, a_arg, b_arg, mpz_cdiv_qr, (gmp_binary_ui_op2_t) mpz_cdiv_qr_ui, 1 TSRMLS_CC); + gmp_zval_binary_ui_op2(return_value, a_arg, b_arg, mpz_cdiv_qr, (gmp_binary_ui_op2_t) mpz_cdiv_qr_ui, 1); break; case GMP_ROUND_MINUSINF: - gmp_zval_binary_ui_op2(return_value, a_arg, b_arg, mpz_fdiv_qr, (gmp_binary_ui_op2_t) mpz_fdiv_qr_ui, 1 TSRMLS_CC); + gmp_zval_binary_ui_op2(return_value, a_arg, b_arg, mpz_fdiv_qr, (gmp_binary_ui_op2_t) mpz_fdiv_qr_ui, 1); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid rounding mode"); + php_error_docref(NULL, E_WARNING, "Invalid rounding mode"); RETURN_FALSE; } } @@ -1265,22 +1265,22 @@ ZEND_FUNCTION(gmp_div_r) zval *a_arg, *b_arg; zend_long round = GMP_ROUND_ZERO; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &a_arg, &b_arg, &round) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|l", &a_arg, &b_arg, &round) == FAILURE) { return; } switch (round) { case GMP_ROUND_ZERO: - gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_tdiv_r, (gmp_binary_ui_op_t) mpz_tdiv_r_ui, 1 TSRMLS_CC); + gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_tdiv_r, (gmp_binary_ui_op_t) mpz_tdiv_r_ui, 1); break; case GMP_ROUND_PLUSINF: - gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_cdiv_r, (gmp_binary_ui_op_t) mpz_cdiv_r_ui, 1 TSRMLS_CC); + gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_cdiv_r, (gmp_binary_ui_op_t) mpz_cdiv_r_ui, 1); break; case GMP_ROUND_MINUSINF: - gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_fdiv_r, (gmp_binary_ui_op_t) mpz_fdiv_r_ui, 1 TSRMLS_CC); + gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_fdiv_r, (gmp_binary_ui_op_t) mpz_fdiv_r_ui, 1); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid rounding mode"); + php_error_docref(NULL, E_WARNING, "Invalid rounding mode"); RETURN_FALSE; } } @@ -1293,22 +1293,22 @@ ZEND_FUNCTION(gmp_div_q) zval *a_arg, *b_arg; zend_long round = GMP_ROUND_ZERO; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &a_arg, &b_arg, &round) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|l", &a_arg, &b_arg, &round) == FAILURE) { return; } switch (round) { case GMP_ROUND_ZERO: - gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_tdiv_q, (gmp_binary_ui_op_t) mpz_tdiv_q_ui, 1 TSRMLS_CC); + gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_tdiv_q, (gmp_binary_ui_op_t) mpz_tdiv_q_ui, 1); break; case GMP_ROUND_PLUSINF: - gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_cdiv_q, (gmp_binary_ui_op_t) mpz_cdiv_q_ui, 1 TSRMLS_CC); + gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_cdiv_q, (gmp_binary_ui_op_t) mpz_cdiv_q_ui, 1); break; case GMP_ROUND_MINUSINF: - gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_fdiv_q, (gmp_binary_ui_op_t) mpz_fdiv_q_ui, 1 TSRMLS_CC); + gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_fdiv_q, (gmp_binary_ui_op_t) mpz_fdiv_q_ui, 1); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid rounding mode"); + php_error_docref(NULL, E_WARNING, "Invalid rounding mode"); RETURN_FALSE; } @@ -1353,24 +1353,24 @@ ZEND_FUNCTION(gmp_fact) { zval *a_arg; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){ return; } if (IS_GMP(a_arg)) { mpz_ptr gmpnum_tmp = GET_GMP_FROM_ZVAL(a_arg); if (mpz_sgn(gmpnum_tmp) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number has to be greater than or equal to 0"); + php_error_docref(NULL, E_WARNING, "Number has to be greater than or equal to 0"); RETURN_FALSE; } } else { if (zval_get_long(a_arg) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number has to be greater than or equal to 0"); + php_error_docref(NULL, E_WARNING, "Number has to be greater than or equal to 0"); RETURN_FALSE; } } - gmp_zval_unary_ui_op(return_value, a_arg, mpz_fac_ui TSRMLS_CC); + gmp_zval_unary_ui_op(return_value, a_arg, mpz_fac_ui); } /* }}} */ @@ -1383,12 +1383,12 @@ ZEND_FUNCTION(gmp_pow) gmp_temp_t temp_base; zend_long exp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &base_arg, &exp) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &base_arg, &exp) == FAILURE) { return; } if (exp < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Negative exponent not supported"); + php_error_docref(NULL, E_WARNING, "Negative exponent not supported"); RETURN_FALSE; } @@ -1412,7 +1412,7 @@ ZEND_FUNCTION(gmp_powm) int use_ui = 0; gmp_temp_t temp_base, temp_exp, temp_mod; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz", &base_arg, &exp_arg, &mod_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zzz", &base_arg, &exp_arg, &mod_arg) == FAILURE){ return; } @@ -1424,7 +1424,7 @@ ZEND_FUNCTION(gmp_powm) } else { FETCH_GMP_ZVAL_DEP(gmpnum_exp, exp_arg, temp_exp, temp_base); if (mpz_sgn(gmpnum_exp) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second parameter cannot be less than 0"); + php_error_docref(NULL, E_WARNING, "Second parameter cannot be less than 0"); FREE_GMP_TEMP(temp_base); FREE_GMP_TEMP(temp_exp); RETURN_FALSE; @@ -1433,7 +1433,7 @@ ZEND_FUNCTION(gmp_powm) FETCH_GMP_ZVAL_DEP_DEP(gmpnum_mod, mod_arg, temp_mod, temp_exp, temp_base); if (!mpz_cmp_ui(gmpnum_mod, 0)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modulus may not be zero"); + php_error_docref(NULL, E_WARNING, "Modulus may not be zero"); FREE_GMP_TEMP(temp_base); FREE_GMP_TEMP(temp_exp); FREE_GMP_TEMP(temp_mod); @@ -1461,14 +1461,14 @@ ZEND_FUNCTION(gmp_sqrt) mpz_ptr gmpnum_a, gmpnum_result; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){ return; } FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); if (mpz_sgn(gmpnum_a) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number has to be greater than or equal to 0"); + php_error_docref(NULL, E_WARNING, "Number has to be greater than or equal to 0"); FREE_GMP_TEMP(temp_a); RETURN_FALSE; } @@ -1488,20 +1488,20 @@ ZEND_FUNCTION(gmp_sqrtrem) gmp_temp_t temp_a; zval result1, result2; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){ return; } FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); if (mpz_sgn(gmpnum_a) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number has to be greater than or equal to 0"); + php_error_docref(NULL, E_WARNING, "Number has to be greater than or equal to 0"); FREE_GMP_TEMP(temp_a); RETURN_FALSE; } - gmp_create(&result1, &gmpnum_result1 TSRMLS_CC); - gmp_create(&result2, &gmpnum_result2 TSRMLS_CC); + gmp_create(&result1, &gmpnum_result1); + gmp_create(&result2, &gmpnum_result2); array_init(return_value); add_next_index_zval(return_value, &result1); @@ -1521,19 +1521,19 @@ ZEND_FUNCTION(gmp_root) mpz_ptr gmpnum_a, gmpnum_result; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &nth) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &a_arg, &nth) == FAILURE) { return; } if (nth <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "The root must be positive"); + php_error_docref(NULL, E_WARNING, "The root must be positive"); RETURN_FALSE; } FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); if (nth % 2 == 0 && mpz_sgn(gmpnum_a) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't take even root of negative number"); + php_error_docref(NULL, E_WARNING, "Can't take even root of negative number"); FREE_GMP_TEMP(temp_a); RETURN_FALSE; } @@ -1554,25 +1554,25 @@ ZEND_FUNCTION(gmp_rootrem) gmp_temp_t temp_a; zval result1, result2; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &nth) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &a_arg, &nth) == FAILURE) { return; } if (nth <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "The root must be positive"); + php_error_docref(NULL, E_WARNING, "The root must be positive"); RETURN_FALSE; } FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); if (nth % 2 == 0 && mpz_sgn(gmpnum_a) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't take even root of negative number"); + php_error_docref(NULL, E_WARNING, "Can't take even root of negative number"); FREE_GMP_TEMP(temp_a); RETURN_FALSE; } - gmp_create(&result1, &gmpnum_result1 TSRMLS_CC); - gmp_create(&result2, &gmpnum_result2 TSRMLS_CC); + gmp_create(&result1, &gmpnum_result1); + gmp_create(&result2, &gmpnum_result2); array_init(return_value); add_next_index_zval(return_value, &result1); @@ -1592,7 +1592,7 @@ ZEND_FUNCTION(gmp_perfect_square) mpz_ptr gmpnum_a; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){ return; } @@ -1612,7 +1612,7 @@ ZEND_FUNCTION(gmp_prob_prime) zend_long reps = 10; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &gmpnumber_arg, &reps) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &gmpnumber_arg, &reps) == FAILURE) { return; } @@ -1640,16 +1640,16 @@ ZEND_FUNCTION(gmp_gcdext) gmp_temp_t temp_a, temp_b; zval result_g, result_s, result_t; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &a_arg, &b_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){ return; } FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); FETCH_GMP_ZVAL_DEP(gmpnum_b, b_arg, temp_b, temp_a); - gmp_create(&result_g, &gmpnum_g TSRMLS_CC); - gmp_create(&result_s, &gmpnum_s TSRMLS_CC); - gmp_create(&result_t, &gmpnum_t TSRMLS_CC); + gmp_create(&result_g, &gmpnum_g); + gmp_create(&result_s, &gmpnum_s); + gmp_create(&result_t, &gmpnum_t); array_init(return_value); add_assoc_zval(return_value, "g", &result_g); @@ -1671,7 +1671,7 @@ ZEND_FUNCTION(gmp_invert) gmp_temp_t temp_a, temp_b; int res; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &a_arg, &b_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){ return; } @@ -1711,11 +1711,11 @@ ZEND_FUNCTION(gmp_cmp) { zval *a_arg, *b_arg; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &a_arg, &b_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){ return; } - gmp_cmp(return_value, a_arg, b_arg TSRMLS_CC); + gmp_cmp(return_value, a_arg, b_arg); } /* }}} */ @@ -1728,7 +1728,7 @@ ZEND_FUNCTION(gmp_sign) mpz_ptr gmpnum_a; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){ return; } @@ -1739,7 +1739,7 @@ ZEND_FUNCTION(gmp_sign) } /* }}} */ -static void gmp_init_random(TSRMLS_D) +static void gmp_init_random(void) { if (!GMPG(rand_initialized)) { /* Initialize */ @@ -1758,12 +1758,12 @@ ZEND_FUNCTION(gmp_random) zend_long limiter = 20; mpz_ptr gmpnum_result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &limiter) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &limiter) == FAILURE) { return; } INIT_GMP_RETVAL(gmpnum_result); - gmp_init_random(TSRMLS_C); + gmp_init_random(); #ifdef GMP_LIMB_BITS mpz_urandomb(gmpnum_result, GMPG(rand_state), GMP_ABS (limiter) * GMP_LIMB_BITS); @@ -1781,11 +1781,11 @@ ZEND_FUNCTION(gmp_random_seed) mpz_ptr gmpnum_seed; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &seed) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &seed) == FAILURE) { return; } - gmp_init_random(TSRMLS_C); + gmp_init_random(); if (Z_TYPE_P(seed) == IS_LONG && Z_LVAL_P(seed) >= 0) { gmp_randseed_ui(GMPG(rand_state), Z_LVAL_P(seed)); @@ -1807,17 +1807,17 @@ ZEND_FUNCTION(gmp_random_bits) zend_long bits; mpz_ptr gmpnum_result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &bits) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &bits) == FAILURE) { return; } if (bits <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "The number of bits must be positive"); + php_error_docref(NULL, E_WARNING, "The number of bits must be positive"); RETURN_FALSE; } INIT_GMP_RETVAL(gmpnum_result); - gmp_init_random(TSRMLS_C); + gmp_init_random(); mpz_urandomb(gmpnum_result, GMPG(rand_state), bits); } @@ -1831,18 +1831,18 @@ ZEND_FUNCTION(gmp_random_range) mpz_ptr gmpnum_min, gmpnum_max, gmpnum_result; gmp_temp_t temp_a, temp_b; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &min_arg, &max_arg) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &min_arg, &max_arg) == FAILURE) { return; } - gmp_init_random(TSRMLS_C); + gmp_init_random(); FETCH_GMP_ZVAL(gmpnum_max, max_arg, temp_a); if (Z_TYPE_P(min_arg) == IS_LONG && Z_LVAL_P(min_arg) >= 0) { if (mpz_cmp_ui(gmpnum_max, Z_LVAL_P(min_arg)) <= 0) { FREE_GMP_TEMP(temp_a); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "The minimum value must be less than the maximum value"); + php_error_docref(NULL, E_WARNING, "The minimum value must be less than the maximum value"); RETURN_FALSE; } @@ -1868,7 +1868,7 @@ ZEND_FUNCTION(gmp_random_range) if (mpz_cmp(gmpnum_max, gmpnum_min) <= 0) { FREE_GMP_TEMP(temp_b); FREE_GMP_TEMP(temp_a); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "The minimum value must be less than the maximum value"); + php_error_docref(NULL, E_WARNING, "The minimum value must be less than the maximum value"); RETURN_FALSE; } @@ -1934,12 +1934,12 @@ ZEND_FUNCTION(gmp_setbit) zend_bool set = 1; mpz_ptr gmpnum_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol|b", &a_arg, gmp_ce, &index, &set) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol|b", &a_arg, gmp_ce, &index, &set) == FAILURE) { return; } if (index < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Index must be greater than or equal to zero"); + php_error_docref(NULL, E_WARNING, "Index must be greater than or equal to zero"); RETURN_FALSE; } @@ -1961,12 +1961,12 @@ ZEND_FUNCTION(gmp_clrbit) zend_long index; mpz_ptr gmpnum_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &a_arg, gmp_ce, &index) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &a_arg, gmp_ce, &index) == FAILURE){ return; } if (index < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Index must be greater than or equal to zero"); + php_error_docref(NULL, E_WARNING, "Index must be greater than or equal to zero"); RETURN_FALSE; } @@ -1984,12 +1984,12 @@ ZEND_FUNCTION(gmp_testbit) mpz_ptr gmpnum_a; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &index) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &a_arg, &index) == FAILURE){ return; } if (index < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Index must be greater than or equal to zero"); + php_error_docref(NULL, E_WARNING, "Index must be greater than or equal to zero"); RETURN_FALSE; } @@ -2024,12 +2024,12 @@ ZEND_FUNCTION(gmp_scan0) gmp_temp_t temp_a; zend_long start; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &start) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &a_arg, &start) == FAILURE){ return; } if (start < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Starting index must be greater than or equal to zero"); + php_error_docref(NULL, E_WARNING, "Starting index must be greater than or equal to zero"); RETURN_FALSE; } @@ -2049,12 +2049,12 @@ ZEND_FUNCTION(gmp_scan1) gmp_temp_t temp_a; zend_long start; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &start) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &a_arg, &start) == FAILURE){ return; } if (start < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Starting index must be greater than or equal to zero"); + php_error_docref(NULL, E_WARNING, "Starting index must be greater than or equal to zero"); RETURN_FALSE; } |