From 3280f6214878474345b9f30a9e18b6d39db4da8b Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sun, 7 Jan 2007 15:11:57 +0000 Subject: [PATCH] prepare for sync of zlib add malloc to usetup. it only will be use by zlib 1.2.3 when the sync is finish svn path=/trunk/; revision=25339 --- reactos/base/setup/usetup/cabinet.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/reactos/base/setup/usetup/cabinet.c b/reactos/base/setup/usetup/cabinet.c index e72a2536248..205101fb2b8 100644 --- a/reactos/base/setup/usetup/cabinet.c +++ b/reactos/base/setup/usetup/cabinet.c @@ -67,6 +67,20 @@ static PVOID CabinetReservedArea = NULL; /* Needed by zlib, but we don't want the dependency on msvcrt.dll */ +/* round to 16 bytes + alloc at minimum 16 bytes */ +#define ROUND_SIZE(size) (max(16, ROUND_UP(size, 16))) + +void* __cdecl malloc(size_t _size) +{ + size_t nSize = ROUND_SIZE(_size); + + if (nSize<_size) + return NULL; + + return RtlAllocateHeap(ProcessHeap, HEAP_ZERO_MEMORY, nSize); +} + + void __cdecl free(void* _ptr) { RtlFreeHeap(ProcessHeap, 0, _ptr);