mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix GH-15094: php_random_default_engine() is not C++ conforming
Using compound literals is conforming to C99 (and up), but not with any C++ standard. Since the code is in a public header, it might be used by C++ extensions. Unfortunately, we cannot even used designated initializers, because these are a C++20 feature, so we stick with classic C/C++ code. Closes GH-15100.
This commit is contained in:
parent
82e63a06e2
commit
da72ac11f6
2 changed files with 8 additions and 4 deletions
|
@ -167,10 +167,10 @@ PHPAPI void *php_random_default_status(void);
|
|||
|
||||
static inline php_random_algo_with_state php_random_default_engine(void)
|
||||
{
|
||||
return (php_random_algo_with_state){
|
||||
.algo = php_random_default_algo(),
|
||||
.state = php_random_default_status(),
|
||||
};
|
||||
php_random_algo_with_state raws;
|
||||
raws.algo = php_random_default_algo();
|
||||
raws.state = php_random_default_status();
|
||||
return raws;
|
||||
}
|
||||
|
||||
PHPAPI zend_string *php_random_bin2hex_le(const void *ptr, const size_t len);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue