1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Use MEM_CONTEXT_NEW_BEGIN() block instead of memContextNew().

A few places were using just memContextNew(), probably because they did not immediately need to create anything in the new context, but it's better if we use the same pattern everywhere, even if it results in a few extra mem context switches.
This commit is contained in:
David Steele 2020-01-17 11:58:41 -07:00
parent d3be1e41a4
commit c6d6b7dbef
4 changed files with 20 additions and 4 deletions

View File

@ -175,7 +175,11 @@ lockAcquire(const String *lockPath, const String *stanza, LockType lockType, Tim
{
MEM_CONTEXT_BEGIN(memContextTop())
{
lockMemContext = memContextNew("Lock");
MEM_CONTEXT_NEW_BEGIN("Lock")
{
lockMemContext = MEM_CONTEXT_NEW();
}
MEM_CONTEXT_NEW_END();
}
MEM_CONTEXT_END();
}

View File

@ -55,7 +55,11 @@ protocolHelperInit(void)
// Create a mem context to store protocol objects
MEM_CONTEXT_BEGIN(memContextTop())
{
protocolHelper.memContext = memContextNew("ProtocolHelper");
MEM_CONTEXT_NEW_BEGIN("ProtocolHelper")
{
protocolHelper.memContext = MEM_CONTEXT_NEW();
}
MEM_CONTEXT_NEW_END();
}
MEM_CONTEXT_END();
}

View File

@ -62,7 +62,11 @@ storageHelperInit(void)
{
MEM_CONTEXT_BEGIN(memContextTop())
{
storageHelper.memContext = memContextNew("storageHelper");
MEM_CONTEXT_NEW_BEGIN("StorageHelper")
{
storageHelper.memContext = MEM_CONTEXT_NEW();
}
MEM_CONTEXT_NEW_END();
}
MEM_CONTEXT_END();
}

View File

@ -188,7 +188,11 @@ hrnLogReplaceAdd(const char *expression, const char *expressionSub, const char *
{
MEM_CONTEXT_BEGIN(memContextTop())
{
harnessLog.memContext = memContextNew("harnessLog");
MEM_CONTEXT_NEW_BEGIN("HarnessLog")
{
harnessLog.memContext = MEM_CONTEXT_NEW();
}
MEM_CONTEXT_NEW_END();
}
MEM_CONTEXT_END();
}