diff --git a/ext/random/php_random.h b/ext/random/php_random.h index d1057b3a73112..b51948658e515 100644 --- a/ext/random/php_random.h +++ b/ext/random/php_random.h @@ -195,14 +195,29 @@ static inline uint64_t php_random_pcgoneseq128xslrr64_rotr64(php_random_uint128_ } # endif -# define php_random_bytes_throw(b, s) php_random_bytes((b), (s), 1) -# define php_random_bytes_silent(b, s) php_random_bytes((b), (s), 0) -# define php_random_int_throw(min, max, result) php_random_int((min), (max), (result), 1) -# define php_random_int_silent(min, max, result) php_random_int((min), (max), (result), 0) - PHPAPI zend_result php_random_bytes(void *bytes, size_t size, bool should_throw); PHPAPI zend_result php_random_int(zend_long min, zend_long max, zend_long *result, bool should_throw); +static inline zend_result php_random_bytes_throw(void *bytes, size_t size) +{ + return php_random_bytes(bytes, size, true); +} + +static inline zend_result php_random_bytes_silent(void *bytes, size_t size) +{ + return php_random_bytes(bytes, size, false); +} + +static inline zend_result php_random_int_throw(zend_long min, zend_long max, zend_long *result) +{ + return php_random_int(min, max, result, true); +} + +static inline zend_result php_random_int_silent(zend_long min, zend_long max, zend_long *result) +{ + return php_random_int(min, max, result, false); +} + typedef struct _php_random_status_ { size_t last_generated_size; void *state;