mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-08-15 09:13:21 +00:00
perf: avoid writing 1MB of zero bytes
Don't initialize the entire just-allocated buffer to all zeroes. The very next lines initialize all members except "data". * exec/totempg.c (assembly_ref): Initialize the first byte of assembly->data to 0, just in case someone uses it as a string. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2116 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
parent
cee464489f
commit
5ac04efe9b
@ -283,12 +283,12 @@ static struct assembly *assembly_ref (unsigned int nodeid)
|
||||
* Nothing available in inuse or free list, so allocate a new one
|
||||
*/
|
||||
assembly = malloc (sizeof (struct assembly));
|
||||
memset (assembly, 0, sizeof (struct assembly));
|
||||
/*
|
||||
* TODO handle memory allocation failure here
|
||||
*/
|
||||
assert (assembly);
|
||||
assembly->nodeid = nodeid;
|
||||
assembly->data[0] = 0;
|
||||
assembly->index = 0;
|
||||
assembly->last_frag_num = 0;
|
||||
assembly->throw_away_mode = THROW_AWAY_INACTIVE;
|
||||
|
Loading…
Reference in New Issue
Block a user