summaryrefslogtreecommitdiff
path: root/Zend/zend_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_alloc.c')
-rw-r--r--Zend/zend_alloc.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 195235ffd9..b8edffeb47 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -488,16 +488,16 @@ static unsigned int _zend_mm_cookie = 0;
#define ZEND_MM_RESERVE_SIZE (8*1024)
#ifdef _WIN64
-# define ZEND_MM_INT_CONST(x) (x##i64)
+# define ZEND_MM_LONG_CONST(x) (x##i64)
#else
-# define ZEND_MM_INT_CONST(x) (x##L)
+# define ZEND_MM_LONG_CONST(x) (x##L)
#endif
-#define ZEND_MM_TYPE_MASK ZEND_MM_INT_CONST(0x3)
+#define ZEND_MM_TYPE_MASK ZEND_MM_LONG_CONST(0x3)
-#define ZEND_MM_FREE_BLOCK ZEND_MM_INT_CONST(0x0)
-#define ZEND_MM_USED_BLOCK ZEND_MM_INT_CONST(0x1)
-#define ZEND_MM_GUARD_BLOCK ZEND_MM_INT_CONST(0x3)
+#define ZEND_MM_FREE_BLOCK ZEND_MM_LONG_CONST(0x0)
+#define ZEND_MM_USED_BLOCK ZEND_MM_LONG_CONST(0x1)
+#define ZEND_MM_GUARD_BLOCK ZEND_MM_LONG_CONST(0x3)
#define ZEND_MM_BLOCK(b, type, size) do { \
size_t _size = (size); \
@@ -742,7 +742,7 @@ static inline void zend_mm_add_to_free_list(zend_mm_heap *heap, zend_mm_free_blo
*p = mm_block;
mm_block->parent = p;
mm_block->prev_free_block = mm_block->next_free_block = mm_block;
- heap->large_free_bitmap |= (ZEND_MM_INT_CONST(1) << index);
+ heap->large_free_bitmap |= (ZEND_MM_LONG_CONST(1) << index);
} else {
size_t m;
@@ -775,7 +775,7 @@ static inline void zend_mm_add_to_free_list(zend_mm_heap *heap, zend_mm_free_blo
prev = ZEND_MM_SMALL_FREE_BUCKET(heap, index);
if (prev->prev_free_block == prev) {
- heap->free_bitmap |= (ZEND_MM_INT_CONST(1) << index);
+ heap->free_bitmap |= (ZEND_MM_LONG_CONST(1) << index);
}
next = prev->next_free_block;
@@ -809,7 +809,7 @@ static inline void zend_mm_remove_from_free_list(zend_mm_heap *heap, zend_mm_fre
ZEND_MM_CHECK_TREE(mm_block);
*mm_block->parent = NULL;
if (mm_block->parent == &heap->large_free_buckets[index]) {
- heap->large_free_bitmap &= ~(ZEND_MM_INT_CONST(1) << index);
+ heap->large_free_bitmap &= ~(ZEND_MM_LONG_CONST(1) << index);
}
} else {
while (*(cp = &(prev->child[prev->child[1] != NULL])) != NULL) {
@@ -847,7 +847,7 @@ subst_block:
size_t index = ZEND_MM_BUCKET_INDEX(ZEND_MM_FREE_BLOCK_SIZE(mm_block));
if (EXPECTED(heap->free_buckets[index*2] == heap->free_buckets[index*2+1])) {
- heap->free_bitmap &= ~(ZEND_MM_INT_CONST(1) << index);
+ heap->free_bitmap &= ~(ZEND_MM_LONG_CONST(1) << index);
}
}
} else if (UNEXPECTED(mm_block->parent == ZEND_MM_REST_BLOCK)) {
@@ -1116,7 +1116,7 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_mem_handlers *handlers,
heap->real_size = 0;
heap->overflow = 0;
heap->real_peak = 0;
- heap->limit = ZEND_MM_INT_CONST(1)<<(ZEND_MM_NUM_BUCKETS-2);
+ heap->limit = ZEND_MM_LONG_CONST(1)<<(ZEND_MM_NUM_BUCKETS-2);
heap->size = 0;
heap->peak = 0;
heap->internal = internal;
@@ -1231,9 +1231,9 @@ ZEND_API zend_mm_heap *zend_mm_startup(void)
}
#if ZEND_DEBUG
-static zend_int_t zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b)
+static zend_long zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b)
{
- zend_int_t leaks = 0;
+ zend_long leaks = 0;
zend_mm_block *p, *q;
p = ZEND_MM_NEXT_BLOCK(b);
@@ -1291,7 +1291,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC)
}
if (!ZEND_MM_IS_FREE_BLOCK(p)) {
if (p->magic == MEM_BLOCK_VALID) {
- zend_int_t repeated;
+ zend_long repeated;
zend_leak_info leak;
ZEND_MM_SET_MAGIC(p, MEM_BLOCK_LEAK);
@@ -1373,7 +1373,7 @@ static int zend_mm_check_ptr(zend_mm_heap *heap, void *ptr, int silent ZEND_FILE
#ifdef ZTS
if (ZEND_MM_BAD_THREAD_ID(p)) {
if (!silent) {
- zend_debug_alloc_output("Invalid pointer: ((thread_id=0x%0.8X) != (expected=0x%0.8X))\n", (zend_int_t)p->thread_id, (zend_int_t)tsrm_thread_id());
+ zend_debug_alloc_output("Invalid pointer: ((thread_id=0x%0.8X) != (expected=0x%0.8X))\n", (zend_long)p->thread_id, (zend_long)tsrm_thread_id());
had_problems = 1;
} else {
return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
@@ -1842,7 +1842,7 @@ static zend_mm_free_block *zend_mm_search_large_block(zend_mm_heap *heap, size_t
best_size = ZEND_MM_FREE_BLOCK_SIZE(p);
best_fit = p;
}
- if ((m & (ZEND_MM_INT_CONST(1) << (ZEND_MM_NUM_BUCKETS-1))) == 0) {
+ if ((m & (ZEND_MM_LONG_CONST(1) << (ZEND_MM_NUM_BUCKETS-1))) == 0) {
if (p->child[1]) {
rst = p->child[1];
}
@@ -2474,7 +2474,7 @@ ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_
static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
{
size_t res = nmemb;
- zend_uint_t overflow = 0;
+ zend_ulong overflow = 0;
__asm__ ("mull %3\n\taddl %4,%0\n\tadcl $0,%1"
: "=&a"(res), "=&d" (overflow)
@@ -2494,7 +2494,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
{
size_t res = nmemb;
- zend_uint_t overflow = 0;
+ zend_ulong overflow = 0;
#ifdef __ILP32__ /* x32 */
# define LP_SUFF "l"
@@ -2523,7 +2523,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
{
size_t res;
- zend_uint_t overflow;
+ zend_ulong overflow;
__asm__ ("umlal %0,%1,%2,%3"
: "=r"(res), "=r"(overflow)
@@ -2544,7 +2544,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
{
size_t res;
- zend_uint_t overflow;
+ zend_ulong overflow;
__asm__ ("mul %0,%2,%3\n\tumulh %1,%2,%3\n\tadds %0,%0,%4\n\tadc %1,%1,xzr"
: "=&r"(res), "=&r"(overflow)
@@ -2630,7 +2630,7 @@ ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LI
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- zend_size_t length;
+ size_t length;
char *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
@@ -2649,7 +2649,7 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
return p;
}
-ZEND_API char *_estrndup(const char *s, zend_size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_API char *_estrndup(const char *s, size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
char *p;
#ifdef ZEND_SIGNALS
@@ -2670,7 +2670,7 @@ ZEND_API char *_estrndup(const char *s, zend_size_t length ZEND_FILE_LINE_DC ZEN
}
-ZEND_API char *zend_strndup(const char *s, zend_size_t length)
+ZEND_API char *zend_strndup(const char *s, size_t length)
{
char *p;
#ifdef ZEND_SIGNALS