summaryrefslogtreecommitdiff
path: root/Zend/zend_alloc.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-06-21 16:55:17 +0300
committerDmitry Stogov <dmitry@zend.com>2016-06-21 16:55:17 +0300
commitebb99a1a3a2ec9216d95c63b267ae0f66074f4de (patch)
tree29fe04067b769d1e622a06fed9c84c6ec3e2d3e6 /Zend/zend_alloc.c
parent16160386982a86e6ec7969c6c89707d38228f19e (diff)
downloadphp-git-ebb99a1a3a2ec9216d95c63b267ae0f66074f4de.tar.gz
Fixed compilation warnings
Diffstat (limited to 'Zend/zend_alloc.c')
-rw-r--r--Zend/zend_alloc.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 76664c01ce..76f1952f93 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -280,9 +280,9 @@ struct _zend_mm_chunk {
zend_mm_heap *heap;
zend_mm_chunk *next;
zend_mm_chunk *prev;
- int free_pages; /* number of free pages */
- int free_tail; /* number of free pages at the end of chunk */
- int num;
+ uint32_t free_pages; /* number of free pages */
+ uint32_t free_tail; /* number of free pages at the end of chunk */
+ uint32_t num;
char reserve[64 - (sizeof(void*) * 3 + sizeof(int) * 3)];
zend_mm_heap heap_slot; /* used only in main chunk */
zend_mm_page_map free_map; /* 512 bits or 64 bytes */
@@ -318,17 +318,17 @@ struct _zend_mm_huge_list {
((void*)(((zend_mm_page*)(chunk)) + (page_num)))
#define _BIN_DATA_SIZE(num, size, elements, pages, x, y) size,
-static const unsigned int bin_data_size[] = {
+static const uint32_t bin_data_size[] = {
ZEND_MM_BINS_INFO(_BIN_DATA_SIZE, x, y)
};
#define _BIN_DATA_ELEMENTS(num, size, elements, pages, x, y) elements,
-static const int bin_elements[] = {
+static const uint32_t bin_elements[] = {
ZEND_MM_BINS_INFO(_BIN_DATA_ELEMENTS, x, y)
};
#define _BIN_DATA_PAGES(num, size, elements, pages, x, y) pages,
-static const int bin_pages[] = {
+static const uint32_t bin_pages[] = {
ZEND_MM_BINS_INFO(_BIN_DATA_PAGES, x, y)
};
@@ -844,13 +844,13 @@ static void zend_mm_change_huge_block_size(zend_mm_heap *heap, void *ptr, size_t
/**************/
#if ZEND_DEBUG
-static void *zend_mm_alloc_pages(zend_mm_heap *heap, int pages_count, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+static void *zend_mm_alloc_pages(zend_mm_heap *heap, uint32_t pages_count, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
#else
-static void *zend_mm_alloc_pages(zend_mm_heap *heap, int pages_count ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+static void *zend_mm_alloc_pages(zend_mm_heap *heap, uint32_t pages_count ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
#endif
{
zend_mm_chunk *chunk = heap->main_chunk;
- int page_num, len;
+ uint32_t page_num, len;
while (1) {
if (UNEXPECTED(chunk->free_pages < pages_count)) {
@@ -906,11 +906,11 @@ static void *zend_mm_alloc_pages(zend_mm_heap *heap, int pages_count ZEND_FILE_L
} else {
/* Best-Fit Search */
int best = -1;
- int best_len = ZEND_MM_PAGES;
- int free_tail = chunk->free_tail;
+ uint32_t best_len = ZEND_MM_PAGES;
+ uint32_t free_tail = chunk->free_tail;
zend_mm_bitset *bitset = chunk->free_map;
zend_mm_bitset tmp = *(bitset++);
- int i = 0;
+ uint32_t i = 0;
while (1) {
/* skip allocated blocks */
@@ -1085,7 +1085,7 @@ static zend_always_inline void zend_mm_delete_chunk(zend_mm_heap *heap, zend_mm_
}
}
-static zend_always_inline void zend_mm_free_pages_ex(zend_mm_heap *heap, zend_mm_chunk *chunk, int page_num, int pages_count, int free_chunk)
+static zend_always_inline void zend_mm_free_pages_ex(zend_mm_heap *heap, zend_mm_chunk *chunk, uint32_t page_num, uint32_t pages_count, int free_chunk)
{
chunk->free_pages += pages_count;
zend_mm_bitset_reset_range(chunk->free_map, page_num, pages_count);
@@ -1178,7 +1178,7 @@ static zend_always_inline int zend_mm_small_size_to_bin(size_t size)
#define ZEND_MM_SMALL_SIZE_TO_BIN(size) zend_mm_small_size_to_bin(size)
-static zend_never_inline void *zend_mm_alloc_small_slow(zend_mm_heap *heap, int bin_num ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+static zend_never_inline void *zend_mm_alloc_small_slow(zend_mm_heap *heap, uint32_t bin_num ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
zend_mm_chunk *chunk;
int page_num;
@@ -1199,7 +1199,8 @@ static zend_never_inline void *zend_mm_alloc_small_slow(zend_mm_heap *heap, int
page_num = ZEND_MM_ALIGNED_OFFSET(bin, ZEND_MM_CHUNK_SIZE) / ZEND_MM_PAGE_SIZE;
chunk->map[page_num] = ZEND_MM_SRUN(bin_num);
if (bin_pages[bin_num] > 1) {
- int i = 1;
+ uint32_t i = 1;
+
do {
chunk->map[page_num+i] = ZEND_MM_NRUN(bin_num, i);
i++;
@@ -1836,7 +1837,8 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap)
size_t page_offset;
int page_num;
zend_mm_page_info info;
- int i, has_free_pages, free_counter;
+ uint32_t i, free_counter;
+ int has_free_pages;
size_t collected = 0;
#if ZEND_MM_CUSTOM
@@ -1947,7 +1949,7 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap)
/* Leak detection */
/******************/
-static zend_long zend_mm_find_leaks_small(zend_mm_chunk *p, int i, int j, zend_leak_info *leak)
+static zend_long zend_mm_find_leaks_small(zend_mm_chunk *p, uint32_t i, uint32_t j, zend_leak_info *leak)
{
int empty = 1;
zend_long count = 0;
@@ -1974,7 +1976,7 @@ static zend_long zend_mm_find_leaks_small(zend_mm_chunk *p, int i, int j, zend_l
return count;
}
-static zend_long zend_mm_find_leaks(zend_mm_heap *heap, zend_mm_chunk *p, int i, zend_leak_info *leak)
+static zend_long zend_mm_find_leaks(zend_mm_heap *heap, zend_mm_chunk *p, uint32_t i, zend_leak_info *leak)
{
zend_long count = 0;
@@ -2032,7 +2034,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap)
zend_leak_info leak;
zend_long repeated = 0;
uint32_t total = 0;
- int i, j;
+ uint32_t i, j;
/* find leaked huge blocks and free them */
list = heap->huge_list;