File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 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)
141141 php_random_randomizer * randomizer = Z_RANDOM_RANDOMIZER_P (ZEND_THIS );
142142 zend_string * retval ;
143143 zend_long length ;
144- uint64_t result ;
145- size_t total_size = 0 , required_size ;
144+ size_t total_size = 0 ;
146145
147146 ZEND_PARSE_PARAMETERS_START (1 , 1 )
148147 Z_PARAM_LONG (length )
@@ -154,17 +153,16 @@ PHP_METHOD(Random_Randomizer, getBytes)
154153 }
155154
156155 retval = zend_string_alloc (length , 0 );
157- required_size = length ;
158156
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 );
161159 if (EG (exception )) {
162160 zend_string_free (retval );
163161 RETURN_THROWS ();
164162 }
165163 for (size_t i = 0 ; i < randomizer -> status -> last_generated_size ; i ++ ) {
166164 ZSTR_VAL (retval )[total_size ++ ] = (result >> (i * 8 )) & 0xff ;
167- if (total_size >= required_size ) {
165+ if (total_size >= length ) {
168166 break ;
169167 }
170168 }
You can’t perform that action at this time.
0 commit comments