Author: hbelusca Date: Sat Jan 9 11:22:20 2016 New Revision: 70557
URL: http://svn.reactos.org/svn/reactos?rev=70557&view=rev Log: [USETUP]: Since calling RtlAllocateHeap with the HEAP_ZERO_MEMORY flag works as expected, just use it instead of manually zero-out the newly-created buffer just after.
Modified: trunk/reactos/base/setup/usetup/inicache.c
Modified: trunk/reactos/base/setup/usetup/inicache.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/inicache.... ============================================================================== --- trunk/reactos/base/setup/usetup/inicache.c [iso-8859-1] (original) +++ trunk/reactos/base/setup/usetup/inicache.c [iso-8859-1] Sat Jan 9 11:22:20 2016 @@ -142,16 +142,13 @@ }
Key = (PINICACHEKEY)RtlAllocateHeap(ProcessHeap, - 0, + HEAP_ZERO_MEMORY, sizeof(INICACHEKEY)); if (Key == NULL) { DPRINT("RtlAllocateHeap() failed\n"); return NULL; } - - RtlZeroMemory(Key, - sizeof(INICACHEKEY));
Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap, 0, @@ -222,15 +219,13 @@ }
Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap, - 0, + HEAP_ZERO_MEMORY, sizeof(INICACHESECTION)); if (Section == NULL) { DPRINT("RtlAllocateHeap() failed\n"); return NULL; } - - RtlZeroMemory(Section, sizeof(INICACHESECTION));
/* Allocate and initialize section name */ Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap, @@ -579,16 +574,13 @@
/* Allocate inicache header */ *Cache = (PINICACHE)RtlAllocateHeap(ProcessHeap, - 0, + HEAP_ZERO_MEMORY, sizeof(INICACHE)); if (*Cache == NULL) { DPRINT("RtlAllocateHeap() failed\n"); return STATUS_INSUFFICIENT_RESOURCES; } - - /* Initialize inicache header */ - RtlZeroMemory(*Cache, sizeof(INICACHE));
/* Parse ini file */ Section = NULL; @@ -842,15 +834,13 @@
/* Allocate key buffer */ Key = (PINICACHEKEY)RtlAllocateHeap(ProcessHeap, - 0, + HEAP_ZERO_MEMORY, sizeof(INICACHEKEY)); if (Key == NULL) { DPRINT("RtlAllocateHeap() failed\n"); return NULL; } - - RtlZeroMemory(Key, sizeof(INICACHEKEY));
/* Allocate name buffer */ Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap, @@ -930,16 +920,13 @@
/* Allocate inicache header */ Cache = (PINICACHE)RtlAllocateHeap(ProcessHeap, - 0, + HEAP_ZERO_MEMORY, sizeof(INICACHE)); if (Cache == NULL) { DPRINT("RtlAllocateHeap() failed\n"); return NULL; } - - /* Initialize inicache header */ - RtlZeroMemory(Cache, sizeof(INICACHE));
return Cache; } @@ -992,15 +979,13 @@
/* Allocate file buffer */ Buffer = (CHAR*)RtlAllocateHeap(ProcessHeap, - 0, + HEAP_ZERO_MEMORY, BufferSize); if (Buffer == NULL) { DPRINT1("RtlAllocateHeap() failed\n"); return STATUS_INSUFFICIENT_RESOURCES; } - - RtlZeroMemory(Buffer, BufferSize);
/* Fill file buffer */ Ptr = Buffer; @@ -1093,15 +1078,13 @@ }
Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap, - 0, + HEAP_ZERO_MEMORY, sizeof(INICACHESECTION)); if (Section == NULL) { DPRINT("RtlAllocateHeap() failed\n"); return NULL; } - - RtlZeroMemory(Section, sizeof(INICACHESECTION));
/* Allocate and initialize section name */ Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,