@@ -50,7 +50,7 @@ typedef struct _spl_ptr_heap {
50
50
spl_ptr_heap_ctor_func ctor ;
51
51
spl_ptr_heap_dtor_func dtor ;
52
52
spl_ptr_heap_cmp_func cmp ;
53
- int count ;
53
+ size_t count ;
54
54
int flags ;
55
55
size_t max_size ;
56
56
size_t elem_size ;
@@ -267,7 +267,7 @@ static spl_ptr_heap *spl_ptr_heap_init(spl_ptr_heap_cmp_func cmp, spl_ptr_heap_c
267
267
/* }}} */
268
268
269
269
static void spl_ptr_heap_insert (spl_ptr_heap * heap , void * elem , void * cmp_userdata ) { /* {{{ */
270
- int i ;
270
+ size_t i ;
271
271
272
272
if (heap -> count + 1 > heap -> max_size ) {
273
273
size_t alloc_size = heap -> max_size * heap -> elem_size ;
@@ -306,8 +306,8 @@ static void *spl_ptr_heap_top(spl_ptr_heap *heap) { /* {{{ */
306
306
/* }}} */
307
307
308
308
static zend_result spl_ptr_heap_delete_top (spl_ptr_heap * heap , void * elem , void * cmp_userdata ) { /* {{{ */
309
- int i , j ;
310
- const int limit = (heap -> count - 1 )/2 ;
309
+ size_t i , j ;
310
+ const size_t limit = (heap -> count - 1 )/2 ;
311
311
void * bottom ;
312
312
313
313
if (heap -> count == 0 ) {
@@ -355,8 +355,6 @@ static zend_result spl_ptr_heap_delete_top(spl_ptr_heap *heap, void *elem, void
355
355
/* }}} */
356
356
357
357
static spl_ptr_heap * spl_ptr_heap_clone (spl_ptr_heap * from ) { /* {{{ */
358
- int i ;
359
-
360
358
spl_ptr_heap * heap = emalloc (sizeof (spl_ptr_heap ));
361
359
362
360
heap -> dtor = from -> dtor ;
@@ -370,7 +368,7 @@ static spl_ptr_heap *spl_ptr_heap_clone(spl_ptr_heap *from) { /* {{{ */
370
368
heap -> elements = safe_emalloc (from -> elem_size , from -> max_size , 0 );
371
369
memcpy (heap -> elements , from -> elements , from -> elem_size * from -> max_size );
372
370
373
- for (i = 0 ; i < heap -> count ; ++ i ) {
371
+ for (size_t i = 0 ; i < heap -> count ; ++ i ) {
374
372
heap -> ctor (spl_heap_elem (heap , i ));
375
373
}
376
374
@@ -384,11 +382,9 @@ static void spl_ptr_heap_destroy(spl_ptr_heap *heap) { /* {{{ */
384
382
return ;
385
383
}
386
384
387
- int i ;
388
-
389
385
heap -> flags |= SPL_HEAP_WRITE_LOCKED ;
390
386
391
- for (i = 0 ; i < heap -> count ; ++ i ) {
387
+ for (size_t i = 0 ; i < heap -> count ; ++ i ) {
392
388
heap -> dtor (spl_heap_elem (heap , i ));
393
389
}
394
390
@@ -399,7 +395,7 @@ static void spl_ptr_heap_destroy(spl_ptr_heap *heap) { /* {{{ */
399
395
}
400
396
/* }}} */
401
397
402
- static int spl_ptr_heap_count (spl_ptr_heap * heap ) { /* {{{ */
398
+ static size_t spl_ptr_heap_count (spl_ptr_heap * heap ) { /* {{{ */
403
399
return heap -> count ;
404
400
}
405
401
/* }}} */
@@ -534,7 +530,7 @@ static HashTable* spl_heap_object_get_debug_info(const zend_class_entry *ce, zen
534
530
535
531
array_init (& heap_array );
536
532
537
- for (zend_ulong i = 0 ; i < intern -> heap -> count ; ++ i ) {
533
+ for (size_t i = 0 ; i < intern -> heap -> count ; ++ i ) {
538
534
if (ce == spl_ce_SplPriorityQueue ) {
539
535
spl_pqueue_elem * pq_elem = spl_heap_elem (intern -> heap , i );
540
536
zval elem ;
0 commit comments