[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.

svn path=/trunk/; revision=70557
This commit is contained in:
Hermès Bélusca-Maïto 2016-01-09 11:22:20 +00:00
parent 9701df346f
commit 119229c8fb

View file

@ -142,7 +142,7 @@ IniCacheAddKey(
}
Key = (PINICACHEKEY)RtlAllocateHeap(ProcessHeap,
0,
HEAP_ZERO_MEMORY,
sizeof(INICACHEKEY));
if (Key == NULL)
{
@ -150,9 +150,6 @@ IniCacheAddKey(
return NULL;
}
RtlZeroMemory(Key,
sizeof(INICACHEKEY));
Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0,
(NameLength + 1) * sizeof(WCHAR));
@ -222,7 +219,7 @@ IniCacheAddSection(
}
Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap,
0,
HEAP_ZERO_MEMORY,
sizeof(INICACHESECTION));
if (Section == NULL)
{
@ -230,8 +227,6 @@ IniCacheAddSection(
return NULL;
}
RtlZeroMemory(Section, sizeof(INICACHESECTION));
/* Allocate and initialize section name */
Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0,
@ -579,7 +574,7 @@ IniCacheLoad(
/* Allocate inicache header */
*Cache = (PINICACHE)RtlAllocateHeap(ProcessHeap,
0,
HEAP_ZERO_MEMORY,
sizeof(INICACHE));
if (*Cache == NULL)
{
@ -587,9 +582,6 @@ IniCacheLoad(
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Initialize inicache header */
RtlZeroMemory(*Cache, sizeof(INICACHE));
/* Parse ini file */
Section = NULL;
Ptr = FileBuffer;
@ -842,7 +834,7 @@ IniCacheInsertKey(
/* Allocate key buffer */
Key = (PINICACHEKEY)RtlAllocateHeap(ProcessHeap,
0,
HEAP_ZERO_MEMORY,
sizeof(INICACHEKEY));
if (Key == NULL)
{
@ -850,8 +842,6 @@ IniCacheInsertKey(
return NULL;
}
RtlZeroMemory(Key, sizeof(INICACHEKEY));
/* Allocate name buffer */
Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0,
@ -930,7 +920,7 @@ IniCacheCreate(VOID)
/* Allocate inicache header */
Cache = (PINICACHE)RtlAllocateHeap(ProcessHeap,
0,
HEAP_ZERO_MEMORY,
sizeof(INICACHE));
if (Cache == NULL)
{
@ -938,9 +928,6 @@ IniCacheCreate(VOID)
return NULL;
}
/* Initialize inicache header */
RtlZeroMemory(Cache, sizeof(INICACHE));
return Cache;
}
@ -992,7 +979,7 @@ IniCacheSave(
/* Allocate file buffer */
Buffer = (CHAR*)RtlAllocateHeap(ProcessHeap,
0,
HEAP_ZERO_MEMORY,
BufferSize);
if (Buffer == NULL)
{
@ -1000,8 +987,6 @@ IniCacheSave(
return STATUS_INSUFFICIENT_RESOURCES;
}
RtlZeroMemory(Buffer, BufferSize);
/* Fill file buffer */
Ptr = Buffer;
Section = Cache->FirstSection;
@ -1093,7 +1078,7 @@ IniCacheAppendSection(
}
Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap,
0,
HEAP_ZERO_MEMORY,
sizeof(INICACHESECTION));
if (Section == NULL)
{
@ -1101,8 +1086,6 @@ IniCacheAppendSection(
return NULL;
}
RtlZeroMemory(Section, sizeof(INICACHESECTION));
/* Allocate and initialize section name */
Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0,