Skip to content

Commit 11f0288

Browse files
authored
random: Drop leading _ from struct names (#21856)
1 parent aeda891 commit 11f0288

3 files changed

Lines changed: 20 additions & 22 deletions

File tree

ext/random/php_random.h

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,6 @@
3636

3737
PHPAPI double php_combined_lcg(void);
3838

39-
typedef struct _php_random_fallback_seed_state php_random_fallback_seed_state;
40-
41-
PHPAPI uint64_t php_random_generate_fallback_seed(void);
42-
PHPAPI uint64_t php_random_generate_fallback_seed_ex(php_random_fallback_seed_state *state);
43-
44-
static inline zend_long GENERATE_SEED(void)
45-
{
46-
return (zend_long)php_random_generate_fallback_seed();
47-
}
48-
4939
# define PHP_MT_RAND_MAX ((zend_long) (0x7FFFFFFF)) /* (1<<31) - 1 */
5040

5141
enum php_random_mt19937_mode {
@@ -60,44 +50,44 @@ PHPAPI uint32_t php_mt_rand(void);
6050
PHPAPI zend_long php_mt_rand_range(zend_long min, zend_long max);
6151
PHPAPI zend_long php_mt_rand_common(zend_long min, zend_long max);
6252

63-
typedef struct _php_random_status_state_mt19937 {
53+
typedef struct php_random_status_state_mt19937 {
6454
uint32_t count;
6555
enum php_random_mt19937_mode mode;
6656
uint32_t state[624];
6757
} php_random_status_state_mt19937;
6858

69-
typedef struct _php_random_status_state_pcgoneseq128xslrr64 {
59+
typedef struct php_random_status_state_pcgoneseq128xslrr64 {
7060
php_random_uint128_t state;
7161
} php_random_status_state_pcgoneseq128xslrr64;
7262

73-
typedef struct _php_random_status_state_xoshiro256starstar {
63+
typedef struct php_random_status_state_xoshiro256starstar {
7464
uint64_t state[4];
7565
} php_random_status_state_xoshiro256starstar;
7666

77-
typedef struct _php_random_status_state_user {
67+
typedef struct php_random_status_state_user {
7868
zend_object *object;
7969
zend_function *generate_method;
8070
} php_random_status_state_user;
8171

82-
typedef struct _php_random_result {
72+
typedef struct php_random_result {
8373
uint64_t result;
8474
size_t size;
8575
} php_random_result;
8676

87-
typedef struct _php_random_algo {
77+
typedef struct php_random_algo {
8878
const size_t state_size;
8979
php_random_result (*generate)(void *state);
9080
zend_long (*range)(void *state, zend_long min, zend_long max);
9181
bool (*serialize)(void *state, HashTable *data);
9282
bool (*unserialize)(void *state, HashTable *data);
9383
} php_random_algo;
9484

95-
typedef struct _php_random_algo_with_state {
85+
typedef struct php_random_algo_with_state {
9686
const php_random_algo *algo;
9787
void *state;
9888
} php_random_algo_with_state;
9989

100-
typedef struct _php_random_fallback_seed_state {
90+
typedef struct php_random_fallback_seed_state {
10191
bool initialized;
10292
unsigned char seed[20];
10393
} php_random_fallback_seed_state;
@@ -108,12 +98,12 @@ extern PHPAPI const php_random_algo php_random_algo_xoshiro256starstar;
10898
extern PHPAPI const php_random_algo php_random_algo_secure;
10999
extern PHPAPI const php_random_algo php_random_algo_user;
110100

111-
typedef struct _php_random_engine {
101+
typedef struct php_random_engine {
112102
php_random_algo_with_state engine;
113103
zend_object std;
114104
} php_random_engine;
115105

116-
typedef struct _php_random_randomizer {
106+
typedef struct php_random_randomizer {
117107
php_random_algo_with_state engine;
118108
bool is_userland_algo;
119109
zend_object std;
@@ -147,6 +137,14 @@ static inline php_random_randomizer *php_random_randomizer_from_obj(zend_object
147137

148138
# define Z_RANDOM_RANDOMIZER_P(zval) php_random_randomizer_from_obj(Z_OBJ_P(zval));
149139

140+
PHPAPI uint64_t php_random_generate_fallback_seed(void);
141+
PHPAPI uint64_t php_random_generate_fallback_seed_ex(php_random_fallback_seed_state *state);
142+
143+
static inline zend_long GENERATE_SEED(void)
144+
{
145+
return (zend_long)php_random_generate_fallback_seed();
146+
}
147+
150148
PHPAPI void *php_random_status_alloc(const php_random_algo *algo, const bool persistent);
151149
PHPAPI void *php_random_status_copy(const php_random_algo *algo, void *old_status, void *new_status);
152150
PHPAPI void php_random_status_free(void *status, const bool persistent);

ext/random/php_random_uint128.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# include <stdint.h>
2222

2323
# if !defined(__SIZEOF_INT128__) || defined(PHP_RANDOM_FORCE_EMULATE_128)
24-
typedef struct _php_random_uint128_t {
24+
typedef struct php_random_uint128_t {
2525
uint64_t hi;
2626
uint64_t lo;
2727
} php_random_uint128_t;

ext/random/php_random_zend_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# include "php_random.h"
2121
# include "zend.h"
2222

23-
typedef struct _php_random_bytes_insecure_state_for_zend {
23+
typedef struct php_random_bytes_insecure_state_for_zend {
2424
bool initialized;
2525
php_random_status_state_xoshiro256starstar xoshiro256starstar_state;
2626
} php_random_bytes_insecure_state_for_zend;

0 commit comments

Comments
 (0)