You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-05 00:28:52 +02:00
Add MEM_CONTEXT_PRIOR() block and update current call sites.
This macro block encapsulates the common pattern of switching to the prior (formerly called old) mem context to return results from a function. Also rename MEM_CONTEXT_OLD() to memContextPrior(). This violates our convention of macros being in all caps but memContextPrior() will become a function very soon so this will reduce churn.
This commit is contained in:
@ -107,7 +107,7 @@ archivePushReadyList(const String *walPath)
|
||||
strSubN(strLstGet(readyListRaw, readyIdx), 0, strSize(strLstGet(readyListRaw, readyIdx)) - STATUS_EXT_READY_SIZE));
|
||||
}
|
||||
|
||||
strLstMove(result, MEM_CONTEXT_OLD());
|
||||
strLstMove(result, memContextPrior());
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
|
||||
@ -173,7 +173,7 @@ archivePushProcessList(const String *walPath)
|
||||
}
|
||||
|
||||
// Return all ready files that are not in the ok list
|
||||
result = strLstMove(strLstMergeAnti(readyList, okList), MEM_CONTEXT_OLD());
|
||||
result = strLstMove(strLstMergeAnti(readyList, okList), memContextPrior());
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
|
||||
@ -233,13 +233,15 @@ archivePushCheck(CipherType cipherType, const String *cipherPass)
|
||||
archiveInfo.systemId);
|
||||
}
|
||||
|
||||
memContextSwitch(MEM_CONTEXT_OLD());
|
||||
result.pgVersion = controlInfo.version;
|
||||
result.pgSystemId = controlInfo.systemId;
|
||||
result.pgWalSegmentSize = controlInfo.walSegmentSize;
|
||||
result.archiveId = strDup(archiveId);
|
||||
result.archiveCipherPass = strDup(infoArchiveCipherPass(info));
|
||||
memContextSwitch(MEM_CONTEXT_TEMP());
|
||||
MEM_CONTEXT_PRIOR_BEGIN()
|
||||
{
|
||||
result.pgVersion = controlInfo.version;
|
||||
result.pgSystemId = controlInfo.systemId;
|
||||
result.pgWalSegmentSize = controlInfo.walSegmentSize;
|
||||
result.archiveId = strDup(archiveId);
|
||||
result.archiveCipherPass = strDup(infoArchiveCipherPass(info));
|
||||
}
|
||||
MEM_CONTEXT_PRIOR_END();
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
|
||||
|
Reference in New Issue
Block a user