@@ -210,8 +210,8 @@ static int apc_iterator_check_expiry(apc_cache_t* cache, apc_cache_entry_t *entr
210
210
/* }}} */
211
211
212
212
/* {{{ apc_iterator_fetch_active */
213
- static int apc_iterator_fetch_active (apc_iterator_t * iterator ) {
214
- int count = 0 ;
213
+ static size_t apc_iterator_fetch_active (apc_iterator_t * iterator ) {
214
+ size_t count = 0 ;
215
215
apc_iterator_item_t * item ;
216
216
time_t t = apc_time ();
217
217
@@ -250,8 +250,8 @@ static int apc_iterator_fetch_active(apc_iterator_t *iterator) {
250
250
/* }}} */
251
251
252
252
/* {{{ apc_iterator_fetch_deleted */
253
- static int apc_iterator_fetch_deleted (apc_iterator_t * iterator ) {
254
- int count = 0 ;
253
+ static size_t apc_iterator_fetch_deleted (apc_iterator_t * iterator ) {
254
+ size_t count = 0 ;
255
255
apc_iterator_item_t * item ;
256
256
257
257
if (!apc_cache_rlock (apc_user_cache )) {
@@ -288,14 +288,13 @@ static int apc_iterator_fetch_deleted(apc_iterator_t *iterator) {
288
288
/* {{{ apc_iterator_totals */
289
289
static void apc_iterator_totals (apc_iterator_t * iterator ) {
290
290
time_t t = apc_time ();
291
- int i ;
292
291
293
292
if (!apc_cache_rlock (apc_user_cache )) {
294
293
return ;
295
294
}
296
295
297
296
php_apc_try {
298
- for (i = 0 ; i < apc_user_cache -> nslots ; i ++ ) {
297
+ for (size_t i = 0 ; i < apc_user_cache -> nslots ; i ++ ) {
299
298
apc_cache_entry_t * entry = apc_user_cache -> slots [i ];
300
299
while (entry ) {
301
300
if (apc_iterator_check_expiry (apc_user_cache , entry , t )) {
@@ -315,18 +314,13 @@ static void apc_iterator_totals(apc_iterator_t *iterator) {
315
314
}
316
315
/* }}} */
317
316
318
- void apc_iterator_obj_init (apc_iterator_t * iterator , zval * search , zend_long format , zend_long chunk_size , zend_long list )
317
+ void apc_iterator_obj_init (apc_iterator_t * iterator , zval * search , zend_long format , size_t chunk_size , zend_long list )
319
318
{
320
319
if (!APCG (enabled )) {
321
320
zend_throw_error (NULL , "APC must be enabled to use APCUIterator" );
322
321
return ;
323
322
}
324
323
325
- if (chunk_size < 0 ) {
326
- apc_error ("APCUIterator chunk size must be 0 or greater" );
327
- return ;
328
- }
329
-
330
324
if (format > APC_ITER_ALL ) {
331
325
apc_error ("APCUIterator format is invalid" );
332
326
return ;
@@ -384,6 +378,11 @@ PHP_METHOD(APCUIterator, __construct) {
384
378
return ;
385
379
}
386
380
381
+ if (chunk_size < 0 ) {
382
+ apc_error ("APCUIterator chunk size must be 0 or greater" );
383
+ return ;
384
+ }
385
+
387
386
apc_iterator_obj_init (iterator , search , format , chunk_size , list );
388
387
}
389
388
0 commit comments