69
69
# include "win32/winutil.h"
70
70
#endif
71
71
72
+ #include <stdbool.h>
72
73
#include <stdio.h>
73
74
#include <stdlib.h>
74
75
#include <string.h>
@@ -196,7 +197,7 @@ typedef struct _zend_mm_free_slot zend_mm_free_slot;
196
197
typedef struct _zend_mm_chunk zend_mm_chunk ;
197
198
typedef struct _zend_mm_huge_list zend_mm_huge_list ;
198
199
199
- int zend_mm_use_huge_pages = 0 ;
200
+ static bool zend_mm_use_huge_pages = false ;
200
201
201
202
/*
202
203
* Memory is retrieved from OS by chunks of fixed size 2MB.
@@ -1912,7 +1913,7 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap)
1912
1913
int page_num ;
1913
1914
zend_mm_page_info info ;
1914
1915
uint32_t i , free_counter ;
1915
- int has_free_pages ;
1916
+ bool has_free_pages ;
1916
1917
size_t collected = 0 ;
1917
1918
1918
1919
#if ZEND_MM_CUSTOM
@@ -1922,7 +1923,7 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap)
1922
1923
#endif
1923
1924
1924
1925
for (i = 0 ; i < ZEND_MM_BINS ; i ++ ) {
1925
- has_free_pages = 0 ;
1926
+ has_free_pages = false ;
1926
1927
p = heap -> free_slot [i ];
1927
1928
while (p != NULL ) {
1928
1929
chunk = (zend_mm_chunk * )ZEND_MM_ALIGNED_BASE (p , ZEND_MM_CHUNK_SIZE );
@@ -1941,7 +1942,7 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap)
1941
1942
ZEND_ASSERT (ZEND_MM_SRUN_BIN_NUM (info ) == i );
1942
1943
free_counter = ZEND_MM_SRUN_FREE_COUNTER (info ) + 1 ;
1943
1944
if (free_counter == bin_elements [i ]) {
1944
- has_free_pages = 1 ;
1945
+ has_free_pages = true ;
1945
1946
}
1946
1947
chunk -> map [page_num ] = ZEND_MM_SRUN_EX (i , free_counter );
1947
1948
p = p -> next_free_slot ;
@@ -2025,7 +2026,7 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap)
2025
2026
2026
2027
static zend_long zend_mm_find_leaks_small (zend_mm_chunk * p , uint32_t i , uint32_t j , zend_leak_info * leak )
2027
2028
{
2028
- int empty = 1 ;
2029
+ bool empty = true ;
2029
2030
zend_long count = 0 ;
2030
2031
int bin_num = ZEND_MM_SRUN_BIN_NUM (p -> map [i ]);
2031
2032
zend_mm_debug_info * dbg = (zend_mm_debug_info * )((char * )p + ZEND_MM_PAGE_SIZE * i + bin_data_size [bin_num ] * (j + 1 ) - ZEND_MM_ALIGNED_SIZE (sizeof (zend_mm_debug_info )));
@@ -2038,7 +2039,7 @@ static zend_long zend_mm_find_leaks_small(zend_mm_chunk *p, uint32_t i, uint32_t
2038
2039
dbg -> filename = NULL ;
2039
2040
dbg -> lineno = 0 ;
2040
2041
} else {
2041
- empty = 0 ;
2042
+ empty = false ;
2042
2043
}
2043
2044
}
2044
2045
j ++ ;
@@ -2869,7 +2870,7 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
2869
2870
2870
2871
tmp = getenv ("USE_ZEND_ALLOC_HUGE_PAGES" );
2871
2872
if (tmp && ZEND_ATOL (tmp )) {
2872
- zend_mm_use_huge_pages = 1 ;
2873
+ zend_mm_use_huge_pages = true ;
2873
2874
}
2874
2875
alloc_globals -> mm_heap = zend_mm_init ();
2875
2876
}
0 commit comments