mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:52:56 +00:00
[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:
parent
9701df346f
commit
119229c8fb
1 changed files with 7 additions and 24 deletions
|
@ -142,7 +142,7 @@ IniCacheAddKey(
|
||||||
}
|
}
|
||||||
|
|
||||||
Key = (PINICACHEKEY)RtlAllocateHeap(ProcessHeap,
|
Key = (PINICACHEKEY)RtlAllocateHeap(ProcessHeap,
|
||||||
0,
|
HEAP_ZERO_MEMORY,
|
||||||
sizeof(INICACHEKEY));
|
sizeof(INICACHEKEY));
|
||||||
if (Key == NULL)
|
if (Key == NULL)
|
||||||
{
|
{
|
||||||
|
@ -150,9 +150,6 @@ IniCacheAddKey(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(Key,
|
|
||||||
sizeof(INICACHEKEY));
|
|
||||||
|
|
||||||
Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
||||||
0,
|
0,
|
||||||
(NameLength + 1) * sizeof(WCHAR));
|
(NameLength + 1) * sizeof(WCHAR));
|
||||||
|
@ -222,7 +219,7 @@ IniCacheAddSection(
|
||||||
}
|
}
|
||||||
|
|
||||||
Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap,
|
Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap,
|
||||||
0,
|
HEAP_ZERO_MEMORY,
|
||||||
sizeof(INICACHESECTION));
|
sizeof(INICACHESECTION));
|
||||||
if (Section == NULL)
|
if (Section == NULL)
|
||||||
{
|
{
|
||||||
|
@ -230,8 +227,6 @@ IniCacheAddSection(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(Section, sizeof(INICACHESECTION));
|
|
||||||
|
|
||||||
/* Allocate and initialize section name */
|
/* Allocate and initialize section name */
|
||||||
Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
||||||
0,
|
0,
|
||||||
|
@ -579,7 +574,7 @@ IniCacheLoad(
|
||||||
|
|
||||||
/* Allocate inicache header */
|
/* Allocate inicache header */
|
||||||
*Cache = (PINICACHE)RtlAllocateHeap(ProcessHeap,
|
*Cache = (PINICACHE)RtlAllocateHeap(ProcessHeap,
|
||||||
0,
|
HEAP_ZERO_MEMORY,
|
||||||
sizeof(INICACHE));
|
sizeof(INICACHE));
|
||||||
if (*Cache == NULL)
|
if (*Cache == NULL)
|
||||||
{
|
{
|
||||||
|
@ -587,9 +582,6 @@ IniCacheLoad(
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize inicache header */
|
|
||||||
RtlZeroMemory(*Cache, sizeof(INICACHE));
|
|
||||||
|
|
||||||
/* Parse ini file */
|
/* Parse ini file */
|
||||||
Section = NULL;
|
Section = NULL;
|
||||||
Ptr = FileBuffer;
|
Ptr = FileBuffer;
|
||||||
|
@ -842,7 +834,7 @@ IniCacheInsertKey(
|
||||||
|
|
||||||
/* Allocate key buffer */
|
/* Allocate key buffer */
|
||||||
Key = (PINICACHEKEY)RtlAllocateHeap(ProcessHeap,
|
Key = (PINICACHEKEY)RtlAllocateHeap(ProcessHeap,
|
||||||
0,
|
HEAP_ZERO_MEMORY,
|
||||||
sizeof(INICACHEKEY));
|
sizeof(INICACHEKEY));
|
||||||
if (Key == NULL)
|
if (Key == NULL)
|
||||||
{
|
{
|
||||||
|
@ -850,8 +842,6 @@ IniCacheInsertKey(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(Key, sizeof(INICACHEKEY));
|
|
||||||
|
|
||||||
/* Allocate name buffer */
|
/* Allocate name buffer */
|
||||||
Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
||||||
0,
|
0,
|
||||||
|
@ -930,7 +920,7 @@ IniCacheCreate(VOID)
|
||||||
|
|
||||||
/* Allocate inicache header */
|
/* Allocate inicache header */
|
||||||
Cache = (PINICACHE)RtlAllocateHeap(ProcessHeap,
|
Cache = (PINICACHE)RtlAllocateHeap(ProcessHeap,
|
||||||
0,
|
HEAP_ZERO_MEMORY,
|
||||||
sizeof(INICACHE));
|
sizeof(INICACHE));
|
||||||
if (Cache == NULL)
|
if (Cache == NULL)
|
||||||
{
|
{
|
||||||
|
@ -938,9 +928,6 @@ IniCacheCreate(VOID)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize inicache header */
|
|
||||||
RtlZeroMemory(Cache, sizeof(INICACHE));
|
|
||||||
|
|
||||||
return Cache;
|
return Cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -992,7 +979,7 @@ IniCacheSave(
|
||||||
|
|
||||||
/* Allocate file buffer */
|
/* Allocate file buffer */
|
||||||
Buffer = (CHAR*)RtlAllocateHeap(ProcessHeap,
|
Buffer = (CHAR*)RtlAllocateHeap(ProcessHeap,
|
||||||
0,
|
HEAP_ZERO_MEMORY,
|
||||||
BufferSize);
|
BufferSize);
|
||||||
if (Buffer == NULL)
|
if (Buffer == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1000,8 +987,6 @@ IniCacheSave(
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(Buffer, BufferSize);
|
|
||||||
|
|
||||||
/* Fill file buffer */
|
/* Fill file buffer */
|
||||||
Ptr = Buffer;
|
Ptr = Buffer;
|
||||||
Section = Cache->FirstSection;
|
Section = Cache->FirstSection;
|
||||||
|
@ -1093,7 +1078,7 @@ IniCacheAppendSection(
|
||||||
}
|
}
|
||||||
|
|
||||||
Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap,
|
Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap,
|
||||||
0,
|
HEAP_ZERO_MEMORY,
|
||||||
sizeof(INICACHESECTION));
|
sizeof(INICACHESECTION));
|
||||||
if (Section == NULL)
|
if (Section == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1101,8 +1086,6 @@ IniCacheAppendSection(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(Section, sizeof(INICACHESECTION));
|
|
||||||
|
|
||||||
/* Allocate and initialize section name */
|
/* Allocate and initialize section name */
|
||||||
Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue