Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-08-21 14:05:50 +0400
committerTon Roosendaal <ton@blender.org>2005-08-21 14:05:50 +0400
commit4d58808512d2e92afd1d4822a494a40f5ca916a3 (patch)
treeac17bab66405c90f94d7016cf4e734536ce8d12b /intern/guardedalloc
parent7804860cf61b8fc522405740180d10181d174187 (diff)
MEM_alloc allocated in units of 8 for 32 bits systems, and units of 4 for
64 bits systems... weird bug. :) It now only does a unit-of-4 check, for all systems. This will work fine, since the malloc code will return aligned anyway, and the guarded alloc system only stores ints in the headers. Also, the sizeof() call will correctly do padding, so there's no risk of allocating too small blocks.
Diffstat (limited to 'intern/guardedalloc')
-rw-r--r--intern/guardedalloc/intern/mallocn.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index 1b1b9437966..cae1e3f05b5 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -193,10 +193,7 @@ void *MEM_mallocN(unsigned int len, char *str)
MemHead *memh;
MemTail *memt;
- if(sizeof(long)==8)
- len = (len + 3 ) & ~3; /* eenheden van 4 */
- else
- len = (len + 7 ) & ~7; /* eenheden van 8 */
+ len = (len + 3 ) & ~3; /* allocate in units of 4 */
memh= (MemHead *)malloc(len+sizeof(MemHead)+sizeof(MemTail));
@@ -227,10 +224,7 @@ void *MEM_callocN(unsigned int len, char *str)
MemHead *memh;
MemTail *memt;
- if(sizeof(long)==8)
- len = (len + 3 ) & ~3; /* eenheden van 4 */
- else
- len = (len + 7 ) & ~7; /* eenheden van 8 */
+ len = (len + 3 ) & ~3; /* allocate in units of 4 */
memh= (MemHead *)calloc(len+sizeof(MemHead)+sizeof(MemTail),1);