summaryrefslogtreecommitdiff
path: root/Zend/zend_alloc.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-10-16 13:49:35 +0200
committerAnatol Belski <ab@php.net>2014-10-16 13:49:35 +0200
commit69fa6523e89c4731b576a46921fd30f0aad7734e (patch)
treea389c99a119b5cf1930682ab340266f07354d7bb /Zend/zend_alloc.c
parent7f1107de9167ab1443a13491f5b70aa3f10fd323 (diff)
parent53a8584123f359c2c32f1869d98e4dd9e0a7a6ab (diff)
downloadphp-git-69fa6523e89c4731b576a46921fd30f0aad7734e.tar.gz
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: Fix allocator for 64bit zend_long with 32bit long Use intptr_t for zend_intptr_t typedef Fix format strings in zend_alloc Drop zend_long64 in favor of int64_t Removed deprecated fields NEWS cleanup NEWS removing the NEWS entry as we had to revert this fix for now Revert "Merge branch 'PHP-5.5' into PHP-5.6" Revert "fix TS build" Revert "Merge branch 'PHP-5.4' into PHP-5.5" Revert "Bug #67965: Fix blocking behavior in non-blocking crypto streams" Revert "Bug #41631: Fix regression from first attempt (6569db8)" NEWS Fixed Bug #65171 imagescale() fails Fixed bug #68234 Fixed bug #68215 (Behavior of foreach has changed) Revert "Bug #41631: Observe socket read timeouts in SSL streams" PHP-5.6.3 is next update NEWS, 5.6.2 will be a security-only release
Diffstat (limited to 'Zend/zend_alloc.c')
-rw-r--r--Zend/zend_alloc.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index c647669ea7..8bc7bcb44d 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -482,7 +482,11 @@ static void zend_mm_munmap(void *addr, size_t size)
static zend_always_inline int zend_mm_bitset_nts(zend_mm_bitset bitset)
{
#if defined(__GNUC__)
+# if SIZEOF_ZEND_LONG == SIZEOF_LONG
return __builtin_ctzl(~bitset);
+# else
+ return __builtin_ctzll(~bitset);
+# endif
#elif defined(_WIN32)
unsigned long index;
@@ -519,7 +523,11 @@ static zend_always_inline int zend_mm_bitset_nts(zend_mm_bitset bitset)
static zend_always_inline int zend_mm_bitset_ntz(zend_mm_bitset bitset)
{
#if defined(__GNUC__)
+# if SIZEOF_ZEND_LONG == SIZEOF_LONG
return __builtin_ctzl(bitset);
+# else
+ return __builtin_ctzll(bitset);
+# endif
#elif defined(_WIN32)
unsigned long index;
@@ -962,9 +970,9 @@ not_found:
if (heap->real_size + ZEND_MM_CHUNK_SIZE > heap->limit) {
if (heap->overflow == 0) {
#if ZEND_DEBUG
- zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_ULONG_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size);
+ zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, size);
#else
- zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted (tried to allocate " ZEND_ULONG_FMT " bytes)", heap->limit, ZEND_MM_PAGE_SIZE * pages_count);
+ zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, ZEND_MM_PAGE_SIZE * pages_count);
#endif
return NULL;
}
@@ -976,9 +984,9 @@ not_found:
#if !ZEND_MM_LIMIT
zend_mm_safe_error(heap, "Out of memory");
#elif ZEND_DEBUG
- zend_mm_safe_error(heap, "Out of memory (allocated %ld) at %s:%d (tried to allocate %lu bytes)", heap->real_size, __zend_filename, __zend_lineno, size);
+ zend_mm_safe_error(heap, "Out of memory (allocated %zu) at %s:%d (tried to allocate %zu bytes)", heap->real_size, __zend_filename, __zend_lineno, size);
#else
- zend_mm_safe_error(heap, "Out of memory (allocated %ld) (tried to allocate %lu bytes)", heap->real_size, ZEND_MM_PAGE_SIZE * pages_count);
+ zend_mm_safe_error(heap, "Out of memory (allocated %zu) (tried to allocate %zu bytes)", heap->real_size, ZEND_MM_PAGE_SIZE * pages_count);
#endif
return NULL;
}
@@ -1415,9 +1423,9 @@ static void *zend_mm_realloc_heap(zend_mm_heap *heap, void *ptr, size_t size ZEN
if (heap->real_size + (new_size - old_size) > heap->limit) {
if (heap->overflow == 0) {
#if ZEND_DEBUG
- zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_ULONG_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size);
+ zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, size);
#else
- zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted (tried to allocate " ZEND_ULONG_FMT " bytes)", heap->limit, size);
+ zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, size);
#endif
return NULL;
}
@@ -1641,9 +1649,9 @@ static void *zend_mm_alloc_huge(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
if (heap->real_size + new_size > heap->limit) {
if (heap->overflow == 0) {
#if ZEND_DEBUG
- zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted at %s:%d (tried to allocate %lu bytes)", heap->limit, __zend_filename, __zend_lineno, size);
+ zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, size);
#else
- zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted (tried to allocate %lu bytes)", heap->limit, size);
+ zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, size);
#endif
return NULL;
}
@@ -1655,9 +1663,9 @@ static void *zend_mm_alloc_huge(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
#if !ZEND_MM_LIMIT
zend_mm_safe_error(heap, "Out of memory");
#elif ZEND_DEBUG
- zend_mm_safe_error(heap, "Out of memory (allocated %ld) at %s:%d (tried to allocate %lu bytes)", heap->real_size, __zend_filename, __zend_lineno, size);
+ zend_mm_safe_error(heap, "Out of memory (allocated %zu) at %s:%d (tried to allocate %zu bytes)", heap->real_size, __zend_filename, __zend_lineno, size);
#else
- zend_mm_safe_error(heap, "Out of memory (allocated %ld) (tried to allocate %lu bytes)", heap->real_size, size);
+ zend_mm_safe_error(heap, "Out of memory (allocated %zu) (tried to allocate %zu bytes)", heap->real_size, size);
#endif
return NULL;
}