com php-src: strig size_t fixes to zend_alloc.*: Zend/zend_alloc.c Zend/zend_alloc.h
| From: | Anatol Belski | Date: | Wed, 16 Oct 2013 09:31:19 +0000 |
| Subject: | com php-src: strig size_t fixes to zend_alloc.*: Zend/zend_alloc.c Zend/zend_alloc.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73516@lists.php.net to get a copy of this message | ||
Commit: 0d0eec58f1a05679b276cb40a74927c37f581b08
Author: Anatol Belski <ab@php.net> Tue, 9 Jul 2013 06:13:08 -0700
Parents: a296d61c055c540c9e3a49c81c8e14678ecdf248
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0d0eec58f1a05679b276cb40a74927c37f581b08
Log:
strig size_t fixes to zend_alloc.*
Changed paths:
M Zend/zend_alloc.c
M Zend/zend_alloc.h
Diff:
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index bf9d000..71bc420 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -433,7 +433,7 @@ struct _zend_mm_heap {
int overflow;
int internal;
#if ZEND_MM_CACHE
- unsigned int cached;
+ size_t cached;
zend_mm_free_block *cache[ZEND_MM_NUM_BUCKETS];
#endif
zend_mm_free_block *free_buckets[ZEND_MM_NUM_BUCKETS*2];
@@ -615,11 +615,11 @@ static unsigned int _zend_mm_cookie = 0;
# define END_MAGIC_SIZE sizeof(unsigned int)
# define ZEND_MM_SET_BLOCK_SIZE(block, __size) do { \
- char *p; \
+ char *__p; \
((zend_mm_block*)(block))->debug.size = (__size); \
- p = ZEND_MM_END_MAGIC_PTR(block); \
+ __p = ZEND_MM_END_MAGIC_PTR(block); \
((zend_mm_block*)(block))->debug.start_magic = _mem_block_start_magic; \
- memcpy(p, &_mem_block_end_magic, END_MAGIC_SIZE); \
+ memcpy(__p, &_mem_block_end_magic, END_MAGIC_SIZE); \
} while (0)
static unsigned int _mem_block_start_magic = 0;
@@ -2619,7 +2619,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)
{
- int length;
+ zend_str_size_int length;
char *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
@@ -2638,7 +2638,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, uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_API char *_estrndup(const char *s, zend_str_size_uint length ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC)
{
char *p;
#ifdef ZEND_SIGNALS
@@ -2659,7 +2659,7 @@ ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC
ZEND_FILE_
}
-ZEND_API char *zend_strndup(const char *s, uint length)
+ZEND_API char *zend_strndup(const char *s, zend_str_size_uint length)
{
char *p;
#ifdef ZEND_SIGNALS
diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h
index 0b4e74d..fbd424c 100644
--- a/Zend/zend_alloc.h
+++ b/Zend/zend_alloc.h
@@ -26,6 +26,7 @@
#include "../TSRM/TSRM.h"
#include "zend.h"
+#include "zend_types.h"
#ifndef ZEND_MM_ALIGNMENT
# define ZEND_MM_ALIGNMENT 8
@@ -52,7 +53,7 @@ typedef struct _zend_leak_info {
BEGIN_EXTERN_C()
-ZEND_API char *zend_strndup(const char *s, unsigned int length) ZEND_ATTRIBUTE_MALLOC;
+ZEND_API char *zend_strndup(const char *s, zend_str_size_uint length) ZEND_ATTRIBUTE_MALLOC;
ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC
ZEND_ATTRIBUTE_ALLOC_SIZE(1);
ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
@@ -63,7 +64,7 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN
ZEND_API void *_safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC);
ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset);
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
ZEND_ATTRIBUTE_MALLOC;
-ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
+ZEND_API char *_estrndup(const char *s, zend_str_size_uint length ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
/* Standard wrapper macros */