File tree 1 file changed +4
-6
lines changed 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -141,8 +141,7 @@ PHP_METHOD(Random_Randomizer, getBytes)
141
141
php_random_randomizer * randomizer = Z_RANDOM_RANDOMIZER_P (ZEND_THIS );
142
142
zend_string * retval ;
143
143
zend_long length ;
144
- uint64_t result ;
145
- size_t total_size = 0 , required_size ;
144
+ size_t total_size = 0 ;
146
145
147
146
ZEND_PARSE_PARAMETERS_START (1 , 1 )
148
147
Z_PARAM_LONG (length )
@@ -154,17 +153,16 @@ PHP_METHOD(Random_Randomizer, getBytes)
154
153
}
155
154
156
155
retval = zend_string_alloc (length , 0 );
157
- required_size = length ;
158
156
159
- while (total_size < required_size ) {
160
- result = randomizer -> algo -> generate (randomizer -> status );
157
+ while (total_size < length ) {
158
+ uint64_t result = randomizer -> algo -> generate (randomizer -> status );
161
159
if (EG (exception )) {
162
160
zend_string_free (retval );
163
161
RETURN_THROWS ();
164
162
}
165
163
for (size_t i = 0 ; i < randomizer -> status -> last_generated_size ; i ++ ) {
166
164
ZSTR_VAL (retval )[total_size ++ ] = (result >> (i * 8 )) & 0xff ;
167
- if (total_size >= required_size ) {
165
+ if (total_size >= length ) {
168
166
break ;
169
167
}
170
168
}
You can’t perform that action at this time.
0 commit comments