mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Add new function dsa_allocate0.
This does the same thing as dsa_allocate, except that the memory is guaranteed to be zero-filled on return. Dilip Kumar, adjusted by me.
This commit is contained in:
@@ -755,6 +755,22 @@ dsa_allocate(dsa_area *area, Size size)
|
||||
return alloc_object(area, size_class);
|
||||
}
|
||||
|
||||
/*
|
||||
* As dsa_allocate, but zeroes the allocated memory.
|
||||
*/
|
||||
dsa_pointer
|
||||
dsa_allocate0(dsa_area *area, Size size)
|
||||
{
|
||||
dsa_pointer dp;
|
||||
char *object;
|
||||
|
||||
dp = dsa_allocate(area, size);
|
||||
object = dsa_get_address(area, dp);
|
||||
memset(object, 0, size);
|
||||
|
||||
return dp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free memory obtained with dsa_allocate.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user