You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-05-22 10:15:16 +02:00
Update info module to recent coding standards.
Add const as appropriate and avoid initializing variables if the variable will definitely be set later on.
This commit is contained in:
+4
-4
@@ -94,7 +94,7 @@ BUFFER_STRDEF_STATIC(INFO_CHECKSUM_END_BUF, "}}");
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN Info *
|
||||
infoNew(const String *cipherPass)
|
||||
infoNew(const String *const cipherPass)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_TEST_PARAM(STRING, cipherPass); // Use FUNCTION_TEST so cipher is not logged
|
||||
@@ -332,7 +332,7 @@ infoSaveValue(InfoSave *const infoSaveData, const char *const section, const cha
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN void
|
||||
infoSave(Info *this, IoWrite *write, InfoSaveCallback *callbackFunction, void *callbackData)
|
||||
infoSave(Info *const this, IoWrite *const write, InfoSaveCallback *const callbackFunction, void *const callbackData)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(INFO, this);
|
||||
@@ -395,7 +395,7 @@ infoSave(Info *this, IoWrite *write, InfoSaveCallback *callbackFunction, void *c
|
||||
Getters/Setters
|
||||
***********************************************************************************************************************************/
|
||||
FN_EXTERN void
|
||||
infoCipherPassSet(Info *this, const String *cipherPass)
|
||||
infoCipherPassSet(Info *const this, const String *const cipherPass)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(INFO, this);
|
||||
@@ -417,7 +417,7 @@ infoCipherPassSet(Info *this, const String *cipherPass)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN void
|
||||
infoLoad(const String *error, InfoLoadCallback *callbackFunction, void *callbackData)
|
||||
infoLoad(const String *const error, InfoLoadCallback *const callbackFunction, void *const callbackData)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STRING, error);
|
||||
|
||||
+15
-13
@@ -57,7 +57,7 @@ infoArchiveNewInternal(void)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN InfoArchive *
|
||||
infoArchiveNew(unsigned int pgVersion, uint64_t pgSystemId, const String *cipherPassSub)
|
||||
infoArchiveNew(const unsigned int pgVersion, const uint64_t pgSystemId, const String *const cipherPassSub)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(UINT, pgVersion);
|
||||
@@ -84,7 +84,7 @@ infoArchiveNew(unsigned int pgVersion, uint64_t pgSystemId, const String *cipher
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN InfoArchive *
|
||||
infoArchiveNewLoad(IoRead *read)
|
||||
infoArchiveNewLoad(IoRead *const read)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(IO_READ, read);
|
||||
@@ -107,7 +107,7 @@ infoArchiveNewLoad(IoRead *read)
|
||||
/**********************************************************************************************************************************/
|
||||
const String *
|
||||
infoArchiveIdHistoryMatch(
|
||||
const InfoArchive *this, const unsigned int historyId, const unsigned int pgVersion, const uint64_t pgSystemId)
|
||||
const InfoArchive *const this, const unsigned int historyId, const unsigned int pgVersion, const uint64_t pgSystemId)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(INFO_ARCHIVE, this);
|
||||
@@ -119,12 +119,12 @@ infoArchiveIdHistoryMatch(
|
||||
ASSERT(this != NULL);
|
||||
|
||||
String *archiveId = NULL;
|
||||
InfoPg *infoPg = infoArchivePg(this);
|
||||
const InfoPg *const infoPg = infoArchivePg(this);
|
||||
|
||||
// Search the history list, from newest to oldest
|
||||
for (unsigned int pgIdx = 0; pgIdx < infoPgDataTotal(infoPg); pgIdx++)
|
||||
{
|
||||
InfoPgData pgDataArchive = infoPgData(infoPg, pgIdx);
|
||||
const InfoPgData pgDataArchive = infoPgData(infoPg, pgIdx);
|
||||
|
||||
// If there is an exact match with the history, system and version then get the archiveId and stop
|
||||
if (historyId == pgDataArchive.id && pgSystemId == pgDataArchive.systemId && pgVersion == pgDataArchive.version)
|
||||
@@ -139,7 +139,7 @@ infoArchiveIdHistoryMatch(
|
||||
{
|
||||
for (unsigned int pgIdx = 0; pgIdx < infoPgDataTotal(infoPg); pgIdx++)
|
||||
{
|
||||
InfoPgData pgDataArchive = infoPgData(infoPg, pgIdx);
|
||||
const InfoPgData pgDataArchive = infoPgData(infoPg, pgIdx);
|
||||
|
||||
if (pgSystemId == pgDataArchive.systemId && pgVersion == pgDataArchive.version)
|
||||
{
|
||||
@@ -165,7 +165,7 @@ infoArchiveIdHistoryMatch(
|
||||
Save to file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
infoArchiveSave(InfoArchive *this, IoWrite *write)
|
||||
infoArchiveSave(InfoArchive *const this, IoWrite *const write)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(INFO_ARCHIVE, this);
|
||||
@@ -186,7 +186,7 @@ infoArchiveSave(InfoArchive *this, IoWrite *write)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN InfoArchive *
|
||||
infoArchivePgSet(InfoArchive *this, unsigned int pgVersion, uint64_t pgSystemId)
|
||||
infoArchivePgSet(InfoArchive *const this, const unsigned int pgVersion, const uint64_t pgSystemId)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(INFO_ARCHIVE, this);
|
||||
@@ -250,7 +250,8 @@ infoArchiveLoadFileCallback(void *const data, const unsigned int try)
|
||||
}
|
||||
|
||||
FN_EXTERN InfoArchive *
|
||||
infoArchiveLoadFile(const Storage *storage, const String *fileName, CipherType cipherType, const String *cipherPass)
|
||||
infoArchiveLoadFile(
|
||||
const Storage *const storage, const String *const fileName, const CipherType cipherType, const String *const cipherPass)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE, storage);
|
||||
@@ -274,7 +275,7 @@ infoArchiveLoadFile(const Storage *storage, const String *fileName, CipherType c
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
const char *fileNamePath = strZ(storagePathP(storage, fileName));
|
||||
const char *const fileNamePath = strZ(storagePathP(storage, fileName));
|
||||
|
||||
TRY_BEGIN()
|
||||
{
|
||||
@@ -303,7 +304,8 @@ infoArchiveLoadFile(const Storage *storage, const String *fileName, CipherType c
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN void
|
||||
infoArchiveSaveFile(
|
||||
InfoArchive *infoArchive, const Storage *storage, const String *fileName, CipherType cipherType, const String *cipherPass)
|
||||
InfoArchive *const infoArchive, const Storage *const storage, const String *const fileName, const CipherType cipherType,
|
||||
const String *const cipherPass)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(INFO_ARCHIVE, infoArchive);
|
||||
@@ -321,8 +323,8 @@ infoArchiveSaveFile(
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
// Write output into a buffer since it needs to be saved to storage twice
|
||||
Buffer *buffer = bufNew(ioBufferSize());
|
||||
IoWrite *write = ioBufferWriteNew(buffer);
|
||||
Buffer *const buffer = bufNew(ioBufferSize());
|
||||
IoWrite *const write = ioBufferWriteNew(buffer);
|
||||
cipherBlockFilterGroupAdd(ioWriteFilterGroup(write), cipherType, cipherModeEncrypt, cipherPass);
|
||||
infoArchiveSave(infoArchive, write);
|
||||
|
||||
|
||||
+41
-34
@@ -65,7 +65,8 @@ infoBackupNewInternal(void)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN InfoBackup *
|
||||
infoBackupNew(unsigned int pgVersion, uint64_t pgSystemId, unsigned int pgCatalogVersion, const String *cipherPassSub)
|
||||
infoBackupNew(
|
||||
const unsigned int pgVersion, const uint64_t pgSystemId, const unsigned int pgCatalogVersion, const String *const cipherPassSub)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(UINT, pgVersion);
|
||||
@@ -123,7 +124,7 @@ Create new object and load contents from a file
|
||||
#define INFO_BACKUP_KEY_OPT_ONLINE "option-online"
|
||||
|
||||
static void
|
||||
infoBackupLoadCallback(void *data, const String *section, const String *key, const String *value)
|
||||
infoBackupLoadCallback(void *const data, const String *const section, const String *const key, const String *const value)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM_P(VOID, data);
|
||||
@@ -231,7 +232,7 @@ infoBackupLoadCallback(void *data, const String *section, const String *key, con
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN InfoBackup *
|
||||
infoBackupNewLoad(IoRead *read)
|
||||
infoBackupNewLoad(IoRead *const read)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(IO_READ, read);
|
||||
@@ -348,7 +349,7 @@ infoBackupSaveCallback(void *const data, const String *const sectionNext, InfoSa
|
||||
}
|
||||
|
||||
static void
|
||||
infoBackupSave(InfoBackup *this, IoWrite *write)
|
||||
infoBackupSave(InfoBackup *const this, IoWrite *const write)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(INFO_BACKUP, this);
|
||||
@@ -369,7 +370,8 @@ infoBackupSave(InfoBackup *this, IoWrite *write)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN InfoBackup *
|
||||
infoBackupPgSet(InfoBackup *this, unsigned int pgVersion, uint64_t pgSystemId, unsigned int pgCatalogVersion)
|
||||
infoBackupPgSet(
|
||||
InfoBackup *const this, const unsigned int pgVersion, const uint64_t pgSystemId, const unsigned int pgCatalogVersion)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(INFO_BACKUP, this);
|
||||
@@ -385,7 +387,7 @@ infoBackupPgSet(InfoBackup *this, unsigned int pgVersion, uint64_t pgSystemId, u
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN InfoBackupData
|
||||
infoBackupData(const InfoBackup *this, unsigned int backupDataIdx)
|
||||
infoBackupData(const InfoBackup *const this, const unsigned int backupDataIdx)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(INFO_BACKUP, this);
|
||||
@@ -399,7 +401,7 @@ infoBackupData(const InfoBackup *this, unsigned int backupDataIdx)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN void
|
||||
infoBackupDataAdd(const InfoBackup *this, const Manifest *manifest)
|
||||
infoBackupDataAdd(const InfoBackup *const this, const Manifest *const manifest)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(INFO_BACKUP, this);
|
||||
@@ -411,7 +413,7 @@ infoBackupDataAdd(const InfoBackup *this, const Manifest *manifest)
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
const ManifestData *manData = manifestData(manifest);
|
||||
const ManifestData *const manData = manifestData(manifest);
|
||||
|
||||
// Calculate backup sizes, references and report errors
|
||||
uint64_t backupSize = 0;
|
||||
@@ -565,7 +567,7 @@ infoBackupDataAnnotationSet(const InfoBackup *const this, const String *const ba
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN void
|
||||
infoBackupDataDelete(const InfoBackup *this, const String *backupDeleteLabel)
|
||||
infoBackupDataDelete(const InfoBackup *const this, const String *const backupDeleteLabel)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(INFO_BACKUP, this);
|
||||
@@ -587,7 +589,7 @@ infoBackupDataDelete(const InfoBackup *this, const String *backupDeleteLabel)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN StringList *
|
||||
infoBackupDataLabelList(const InfoBackup *this, const String *expression)
|
||||
infoBackupDataLabelList(const InfoBackup *const this, const String *const expression)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(INFO_BACKUP, this);
|
||||
@@ -597,17 +599,17 @@ infoBackupDataLabelList(const InfoBackup *this, const String *expression)
|
||||
ASSERT(this != NULL);
|
||||
|
||||
// Return a 0 sized list if no current backups or none matching the filter
|
||||
StringList *result = strLstNew();
|
||||
StringList *const result = strLstNew();
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
// Prepare regexp if an expression was passed
|
||||
RegExp *regExp = (expression == NULL) ? NULL : regExpNew(expression);
|
||||
RegExp *const regExp = (expression == NULL) ? NULL : regExpNew(expression);
|
||||
|
||||
// For each backup label, compare it to the filter (if any) and sort it for return
|
||||
for (unsigned int backupLabelIdx = 0; backupLabelIdx < infoBackupDataTotal(this); backupLabelIdx++)
|
||||
{
|
||||
InfoBackupData backupData = infoBackupData(this, backupLabelIdx);
|
||||
const InfoBackupData backupData = infoBackupData(this, backupLabelIdx);
|
||||
|
||||
if (regExp == NULL || regExpMatch(regExp, backupData.backupLabel))
|
||||
{
|
||||
@@ -622,7 +624,7 @@ infoBackupDataLabelList(const InfoBackup *this, const String *expression)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN StringList *
|
||||
infoBackupDataDependentList(const InfoBackup *this, const String *backupLabel)
|
||||
infoBackupDataDependentList(const InfoBackup *const this, const String *const backupLabel)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(INFO_BACKUP, this);
|
||||
@@ -633,7 +635,7 @@ infoBackupDataDependentList(const InfoBackup *this, const String *backupLabel)
|
||||
ASSERT(backupLabel != NULL);
|
||||
|
||||
// Return the given label as the only dependency or the given label and a list of labels that depend on it
|
||||
StringList *result = strLstNew();
|
||||
StringList *const result = strLstNew();
|
||||
strLstAdd(result, backupLabel);
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
@@ -641,7 +643,7 @@ infoBackupDataDependentList(const InfoBackup *this, const String *backupLabel)
|
||||
// For each backup label from oldest to newest in the current section, add each dependency to the list
|
||||
for (unsigned int backupLabelIdx = 0; backupLabelIdx < infoBackupDataTotal(this); backupLabelIdx++)
|
||||
{
|
||||
InfoBackupData backupData = infoBackupData(this, backupLabelIdx);
|
||||
const InfoBackupData backupData = infoBackupData(this, backupLabelIdx);
|
||||
|
||||
// If the backupPrior is in the dependency chain add the label to the list
|
||||
if (backupData.backupPrior != NULL && strLstExists(result, backupData.backupPrior))
|
||||
@@ -702,7 +704,8 @@ infoBackupLoadFileCallback(void *const data, const unsigned int try)
|
||||
}
|
||||
|
||||
FN_EXTERN InfoBackup *
|
||||
infoBackupLoadFile(const Storage *storage, const String *fileName, CipherType cipherType, const String *cipherPass)
|
||||
infoBackupLoadFile(
|
||||
const Storage *const storage, const String *const fileName, const CipherType cipherType, const String *const cipherPass)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE, storage);
|
||||
@@ -726,7 +729,7 @@ infoBackupLoadFile(const Storage *storage, const String *fileName, CipherType ci
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
const char *fileNamePath = strZ(storagePathP(storage, fileName));
|
||||
const char *const fileNamePath = strZ(storagePathP(storage, fileName));
|
||||
|
||||
TRY_BEGIN()
|
||||
{
|
||||
@@ -752,7 +755,8 @@ infoBackupLoadFile(const Storage *storage, const String *fileName, CipherType ci
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN InfoBackup *
|
||||
infoBackupLoadFileReconstruct(const Storage *storage, const String *fileName, CipherType cipherType, const String *cipherPass)
|
||||
infoBackupLoadFileReconstruct(
|
||||
const Storage *const storage, const String *const fileName, const CipherType cipherType, const String *const cipherPass)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE, storage);
|
||||
@@ -765,34 +769,35 @@ infoBackupLoadFileReconstruct(const Storage *storage, const String *fileName, Ci
|
||||
ASSERT(fileName != NULL);
|
||||
ASSERT((cipherType == cipherTypeNone && cipherPass == NULL) || (cipherType != cipherTypeNone && cipherPass != NULL));
|
||||
|
||||
InfoBackup *infoBackup = infoBackupLoadFile(storage, fileName, cipherType, cipherPass);
|
||||
InfoBackup *const infoBackup = infoBackupLoadFile(storage, fileName, cipherType, cipherPass);
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
// Get a list of backups in the repo
|
||||
StringList *backupList = strLstSort(
|
||||
const StringList *const backupList = strLstSort(
|
||||
storageListP(
|
||||
storage, STORAGE_REPO_BACKUP_STR,
|
||||
.expression = backupRegExpP(.full = true, .differential = true, .incremental = true)),
|
||||
sortOrderAsc);
|
||||
|
||||
// Get the list of current backups and remove backups from current that are no longer in the repository
|
||||
StringList *backupCurrentList = strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc);
|
||||
const StringList *backupCurrentList = strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc);
|
||||
|
||||
for (unsigned int backupCurrIdx = 0; backupCurrIdx < strLstSize(backupCurrentList); backupCurrIdx++)
|
||||
{
|
||||
String *backupLabel = strLstGet(backupCurrentList, backupCurrIdx);
|
||||
String *manifestFileName = strNewFmt(STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE, strZ(backupLabel));
|
||||
const String *const backupLabel = strLstGet(backupCurrentList, backupCurrIdx);
|
||||
const String *const manifestFileName = strNewFmt(STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE, strZ(backupLabel));
|
||||
|
||||
// If the manifest does not exist on disk and this backup has not already been deleted from the current list in the
|
||||
// infoBackup object, then remove it and its dependencies
|
||||
if (!storageExistsP(storage, manifestFileName) && infoBackupLabelExists(infoBackup, backupLabel))
|
||||
{
|
||||
StringList *backupList = strLstSort(infoBackupDataDependentList(infoBackup, backupLabel), sortOrderDesc);
|
||||
const StringList *const backupList = strLstSort(
|
||||
infoBackupDataDependentList(infoBackup, backupLabel), sortOrderDesc);
|
||||
|
||||
for (unsigned int backupIdx = 0; backupIdx < strLstSize(backupList); backupIdx++)
|
||||
{
|
||||
String *removeBackup = strLstGet(backupList, backupIdx);
|
||||
const String *const removeBackup = strLstGet(backupList, backupIdx);
|
||||
|
||||
LOG_WARN_FMT("backup '%s' missing manifest removed from " INFO_BACKUP_FILE, strZ(removeBackup));
|
||||
|
||||
@@ -807,26 +812,27 @@ infoBackupLoadFileReconstruct(const Storage *storage, const String *fileName, Ci
|
||||
// For each backup in the repo, check if it exists in backup.info
|
||||
for (unsigned int backupIdx = 0; backupIdx < strLstSize(backupList); backupIdx++)
|
||||
{
|
||||
String *backupLabel = strLstGet(backupList, backupIdx);
|
||||
const String *const backupLabel = strLstGet(backupList, backupIdx);
|
||||
|
||||
// If it does not exist in the list of current backups, then if it is valid, add it
|
||||
if (!strLstExists(backupCurrentList, backupLabel))
|
||||
{
|
||||
String *manifestFileName = strNewFmt(STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE, strZ(backupLabel));
|
||||
const String *const manifestFileName = strNewFmt(
|
||||
STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE, strZ(backupLabel));
|
||||
|
||||
// Check if a completed backup exists (backup.manifest only - ignore .copy)
|
||||
if (storageExistsP(storage, manifestFileName))
|
||||
{
|
||||
bool found = false;
|
||||
const Manifest *manifest = manifestLoadFile(
|
||||
const Manifest *const manifest = manifestLoadFile(
|
||||
storage, manifestFileName, cipherType, infoPgCipherPass(infoBackupPg(infoBackup)));
|
||||
const ManifestData *manData = manifestData(manifest);
|
||||
const ManifestData *const manData = manifestData(manifest);
|
||||
|
||||
// If the pg data for the manifest exists in the history, then add it to current, but if something doesn't match
|
||||
// then warn that the backup is not valid
|
||||
for (unsigned int pgIdx = 0; pgIdx < infoPgDataTotal(infoBackupPg(infoBackup)); pgIdx++)
|
||||
{
|
||||
InfoPgData pgHistory = infoPgData(infoBackupPg(infoBackup), pgIdx);
|
||||
const InfoPgData pgHistory = infoPgData(infoBackupPg(infoBackup), pgIdx);
|
||||
|
||||
// If there is an exact match with the history, system and version and there is no backup-prior dependency
|
||||
// or there is a backup-prior and it is in the list, then add this backup to the current backup list
|
||||
@@ -855,7 +861,8 @@ infoBackupLoadFileReconstruct(const Storage *storage, const String *fileName, Ci
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN void
|
||||
infoBackupSaveFile(
|
||||
InfoBackup *infoBackup, const Storage *storage, const String *fileName, CipherType cipherType, const String *cipherPass)
|
||||
InfoBackup *const infoBackup, const Storage *const storage, const String *const fileName, const CipherType cipherType,
|
||||
const String *const cipherPass)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(INFO_BACKUP, infoBackup);
|
||||
@@ -873,8 +880,8 @@ infoBackupSaveFile(
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
// Write output into a buffer since it needs to be saved to storage twice
|
||||
Buffer *buffer = bufNew(ioBufferSize());
|
||||
IoWrite *write = ioBufferWriteNew(buffer);
|
||||
Buffer *const buffer = bufNew(ioBufferSize());
|
||||
IoWrite *const write = ioBufferWriteNew(buffer);
|
||||
cipherBlockFilterGroupAdd(ioWriteFilterGroup(write), cipherType, cipherModeEncrypt, cipherPass);
|
||||
infoBackupSave(infoBackup, write);
|
||||
|
||||
|
||||
+12
-12
@@ -37,7 +37,7 @@ struct InfoPg
|
||||
Internal constructor
|
||||
***********************************************************************************************************************************/
|
||||
static InfoPg *
|
||||
infoPgNewInternal(InfoPgType type)
|
||||
infoPgNewInternal(const InfoPgType type)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STRING_ID, type);
|
||||
@@ -62,7 +62,7 @@ infoPgNewInternal(InfoPgType type)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN InfoPg *
|
||||
infoPgNew(InfoPgType type, const String *cipherPassSub)
|
||||
infoPgNew(const InfoPgType type, const String *const cipherPassSub)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STRING_ID, type);
|
||||
@@ -156,7 +156,7 @@ infoPgLoadCallback(void *const data, const String *const section, const String *
|
||||
}
|
||||
|
||||
FN_EXTERN InfoPg *
|
||||
infoPgNewLoad(IoRead *read, InfoPgType type, InfoLoadNewCallback *callbackFunction, void *callbackData)
|
||||
infoPgNewLoad(IoRead *const read, const InfoPgType type, InfoLoadNewCallback *const callbackFunction, void *const callbackData)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(IO_READ, read);
|
||||
@@ -207,7 +207,7 @@ infoPgNewLoad(IoRead *read, InfoPgType type, InfoLoadNewCallback *callbackFuncti
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN void
|
||||
infoPgAdd(InfoPg *this, const InfoPgData *infoPgData)
|
||||
infoPgAdd(InfoPg *const this, const InfoPgData *const infoPgData)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(INFO_PG, this);
|
||||
@@ -226,7 +226,8 @@ infoPgAdd(InfoPg *this, const InfoPgData *infoPgData)
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN InfoPg *
|
||||
infoPgSet(
|
||||
InfoPg *this, InfoPgType type, const unsigned int pgVersion, const uint64_t pgSystemId, const unsigned int pgCatalogVersion)
|
||||
InfoPg *const this, const InfoPgType type, const unsigned int pgVersion, const uint64_t pgSystemId,
|
||||
const unsigned int pgCatalogVersion)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(INFO_PG, this);
|
||||
@@ -301,7 +302,7 @@ infoPgSaveCallback(void *const data, const String *const sectionNext, InfoSave *
|
||||
if (saveData->callbackFunction != NULL)
|
||||
saveData->callbackFunction(saveData->callbackData, STRDEF(INFO_SECTION_DB), infoSaveData);
|
||||
|
||||
InfoPgData pgData = infoPgDataCurrent(saveData->infoPg);
|
||||
const InfoPgData pgData = infoPgDataCurrent(saveData->infoPg);
|
||||
|
||||
// These need to be saved because older pgBackRest versions expect them
|
||||
if (saveData->infoPg->type == infoPgBackup)
|
||||
@@ -356,7 +357,7 @@ infoPgSaveCallback(void *const data, const String *const sectionNext, InfoSave *
|
||||
}
|
||||
|
||||
FN_EXTERN void
|
||||
infoPgSave(InfoPg *this, IoWrite *write, InfoSaveCallback *callbackFunction, void *callbackData)
|
||||
infoPgSave(InfoPg *const this, IoWrite *const write, InfoSaveCallback *const callbackFunction, void *const callbackData)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(INFO_PG, this);
|
||||
@@ -398,7 +399,6 @@ infoPgArchiveId(const InfoPg *const this, const unsigned int pgDataIdx)
|
||||
|
||||
const InfoPgData pgData = infoPgData(this, pgDataIdx);
|
||||
String *const version = pgVersionToStr(pgData.version);
|
||||
|
||||
String *const result = strNewFmt("%s-%u", strZ(version), pgData.id);
|
||||
|
||||
strFree(version);
|
||||
@@ -408,7 +408,7 @@ infoPgArchiveId(const InfoPg *const this, const unsigned int pgDataIdx)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN InfoPgData
|
||||
infoPgData(const InfoPg *this, unsigned int pgDataIdx)
|
||||
infoPgData(const InfoPg *const this, const unsigned int pgDataIdx)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(INFO_PG, this);
|
||||
@@ -422,7 +422,7 @@ infoPgData(const InfoPg *this, unsigned int pgDataIdx)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN InfoPgData
|
||||
infoPgDataCurrent(const InfoPg *this)
|
||||
infoPgDataCurrent(const InfoPg *const this)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(INFO_PG, this);
|
||||
@@ -435,7 +435,7 @@ infoPgDataCurrent(const InfoPg *this)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN unsigned int
|
||||
infoPgDataCurrentId(const InfoPg *this)
|
||||
infoPgDataCurrentId(const InfoPg *const this)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(INFO_PG, this);
|
||||
@@ -448,7 +448,7 @@ infoPgDataCurrentId(const InfoPg *this)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN unsigned int
|
||||
infoPgCurrentDataId(const InfoPg *this)
|
||||
infoPgCurrentDataId(const InfoPg *const this)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(INFO_PG, this);
|
||||
|
||||
+67
-66
@@ -48,7 +48,7 @@ Internal functions to add types to their lists
|
||||
***********************************************************************************************************************************/
|
||||
// Helper to add owner to the owner list if it is not there already and return the pointer. This saves a lot of space.
|
||||
static const String *
|
||||
manifestOwnerCache(Manifest *this, const String *owner)
|
||||
manifestOwnerCache(Manifest *const this, const String *const owner)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -64,7 +64,7 @@ manifestOwnerCache(Manifest *this, const String *owner)
|
||||
}
|
||||
|
||||
static void
|
||||
manifestDbAdd(Manifest *this, const ManifestDb *db)
|
||||
manifestDbAdd(Manifest *const this, const ManifestDb *const db)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -77,7 +77,7 @@ manifestDbAdd(Manifest *this, const ManifestDb *db)
|
||||
|
||||
MEM_CONTEXT_BEGIN(lstMemContext(this->pub.dbList))
|
||||
{
|
||||
ManifestDb dbAdd =
|
||||
const ManifestDb dbAdd =
|
||||
{
|
||||
.id = db->id,
|
||||
.lastSystemId = db->lastSystemId,
|
||||
@@ -461,7 +461,7 @@ manifestFilePackUpdate(Manifest *const this, ManifestFilePack **const filePack,
|
||||
}
|
||||
|
||||
FN_EXTERN void
|
||||
manifestLinkAdd(Manifest *this, const ManifestLink *link)
|
||||
manifestLinkAdd(Manifest *const this, const ManifestLink *const link)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -475,7 +475,7 @@ manifestLinkAdd(Manifest *this, const ManifestLink *link)
|
||||
|
||||
MEM_CONTEXT_BEGIN(lstMemContext(this->pub.linkList))
|
||||
{
|
||||
ManifestLink linkAdd =
|
||||
const ManifestLink linkAdd =
|
||||
{
|
||||
.destination = strDup(link->destination),
|
||||
.name = strDup(link->name),
|
||||
@@ -491,7 +491,7 @@ manifestLinkAdd(Manifest *this, const ManifestLink *link)
|
||||
}
|
||||
|
||||
static void
|
||||
manifestPathAdd(Manifest *this, const ManifestPath *path)
|
||||
manifestPathAdd(Manifest *const this, const ManifestPath *const path)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -504,7 +504,7 @@ manifestPathAdd(Manifest *this, const ManifestPath *path)
|
||||
|
||||
MEM_CONTEXT_BEGIN(lstMemContext(this->pub.pathList))
|
||||
{
|
||||
ManifestPath pathAdd =
|
||||
const ManifestPath pathAdd =
|
||||
{
|
||||
.mode = path->mode,
|
||||
.name = strDup(path->name),
|
||||
@@ -520,7 +520,7 @@ manifestPathAdd(Manifest *this, const ManifestPath *path)
|
||||
}
|
||||
|
||||
FN_EXTERN void
|
||||
manifestTargetAdd(Manifest *this, const ManifestTarget *target)
|
||||
manifestTargetAdd(Manifest *const this, const ManifestTarget *const target)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -534,7 +534,7 @@ manifestTargetAdd(Manifest *this, const ManifestTarget *target)
|
||||
|
||||
MEM_CONTEXT_BEGIN(lstMemContext(this->pub.targetList))
|
||||
{
|
||||
ManifestTarget targetAdd =
|
||||
const ManifestTarget targetAdd =
|
||||
{
|
||||
.file = strDup(target->file),
|
||||
.name = strDup(target->name),
|
||||
@@ -615,7 +615,7 @@ manifestLinkCheckInit(void)
|
||||
|
||||
// Helper to check a single link specified by targetIdx
|
||||
static void
|
||||
manifestLinkCheckOne(const Manifest *this, ManifestLinkCheck *linkCheck, unsigned int targetIdx)
|
||||
manifestLinkCheckOne(const Manifest *const this, ManifestLinkCheck *const linkCheck, const unsigned int targetIdx)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(MANIFEST, this);
|
||||
@@ -630,7 +630,7 @@ manifestLinkCheckOne(const Manifest *this, ManifestLinkCheck *linkCheck, unsigne
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
const ManifestTarget *target1 = manifestTarget(this, targetIdx);
|
||||
const ManifestTarget *const target1 = manifestTarget(this, targetIdx);
|
||||
|
||||
// Only check link targets
|
||||
if (target1->type == manifestTargetTypeLink)
|
||||
@@ -700,7 +700,7 @@ manifestLinkCheckOne(const Manifest *this, ManifestLinkCheck *linkCheck, unsigne
|
||||
lstSort(linkCheck->linkList, sortOrderAsc);
|
||||
|
||||
// Find the path in the sorted list
|
||||
unsigned int linkIdx = lstFindIdx(linkCheck->linkList, &path);
|
||||
const unsigned int linkIdx = lstFindIdx(linkCheck->linkList, &path);
|
||||
ASSERT(linkIdx != LIST_NOT_FOUND);
|
||||
|
||||
// Check path links against other links (file links have already been checked)
|
||||
@@ -765,7 +765,7 @@ manifestLinkCheckOne(const Manifest *this, ManifestLinkCheck *linkCheck, unsigne
|
||||
}
|
||||
|
||||
FN_EXTERN void
|
||||
manifestLinkCheck(const Manifest *this)
|
||||
manifestLinkCheck(const Manifest *const this)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(MANIFEST, this);
|
||||
@@ -901,7 +901,7 @@ manifestBuildInfo(
|
||||
FUNCTION_TEST_RETURN_VOID();
|
||||
|
||||
// Get build data
|
||||
unsigned int pgVersion = buildData->manifest->pub.data.pgVersion;
|
||||
const unsigned int pgVersion = buildData->manifest->pub.data.pgVersion;
|
||||
|
||||
// Construct the name used to identify this file/link/path in the manifest
|
||||
const String *manifestName = strNewFmt("%s/%s", strZ(manifestParentName), strZ(info->name));
|
||||
@@ -932,7 +932,7 @@ manifestBuildInfo(
|
||||
}
|
||||
|
||||
// Add path to manifest
|
||||
ManifestPath path =
|
||||
const ManifestPath path =
|
||||
{
|
||||
.name = manifestName,
|
||||
.mode = info->mode,
|
||||
@@ -1120,9 +1120,8 @@ manifestBuildInfo(
|
||||
// If the destination is another link then error. In the future we'll allow this by following the link chain to the
|
||||
// eventual destination but for now we are trying to maintain compatibility during the migration. To do this check we
|
||||
// need to read outside of the data directory but it is a read-only operation so is considered safe.
|
||||
const String *linkDestinationAbsolute = strPathAbsolute(info->linkDestination, pgPath);
|
||||
|
||||
StorageInfo linkedCheck = storageInfoP(
|
||||
const String *const linkDestinationAbsolute = strPathAbsolute(info->linkDestination, pgPath);
|
||||
const StorageInfo linkedCheck = storageInfoP(
|
||||
buildData->storagePg, linkDestinationAbsolute, .ignoreMissing = true, .noPathEnforce = true);
|
||||
|
||||
if (linkedCheck.exists && linkedCheck.type == storageTypeLink)
|
||||
@@ -1133,7 +1132,7 @@ manifestBuildInfo(
|
||||
}
|
||||
|
||||
// Initialize link and target
|
||||
ManifestLink link =
|
||||
const ManifestLink link =
|
||||
{
|
||||
.name = manifestName,
|
||||
.user = info->user,
|
||||
@@ -1195,7 +1194,7 @@ manifestBuildInfo(
|
||||
// Add a dummy pg_tblspc path entry if it does not already exist. This entry will be ignored by restore but it is
|
||||
// part of the original manifest format so we need to have it.
|
||||
lstSort(buildData->manifest->pub.pathList, sortOrderAsc);
|
||||
const ManifestPath *pathBase = manifestPathFind(buildData->manifest, MANIFEST_TARGET_PGDATA_STR);
|
||||
const ManifestPath *const pathBase = manifestPathFind(buildData->manifest, MANIFEST_TARGET_PGDATA_STR);
|
||||
|
||||
if (manifestPathFindDefault(buildData->manifest, MANIFEST_TARGET_PGTBLSPC_STR, NULL) == NULL)
|
||||
{
|
||||
@@ -1213,10 +1212,10 @@ manifestBuildInfo(
|
||||
// The tablespace link destination path is not the path where data will be stored so we can just store it as a dummy
|
||||
// path. This is because PostgreSQL creates a subpath with the version/catalog number so that multiple versions of
|
||||
// PostgreSQL can share a tablespace, which makes upgrades easier.
|
||||
const ManifestPath *pathTblSpc = manifestPathFind(
|
||||
const ManifestPath *const pathTblSpc = manifestPathFind(
|
||||
buildData->manifest, STRDEF(MANIFEST_TARGET_PGDATA "/" MANIFEST_TARGET_PGTBLSPC));
|
||||
|
||||
ManifestPath path =
|
||||
const ManifestPath path =
|
||||
{
|
||||
.name = manifestName,
|
||||
.mode = pathTblSpc->mode,
|
||||
@@ -1234,7 +1233,7 @@ manifestBuildInfo(
|
||||
}
|
||||
|
||||
// Add info about the linked file/path
|
||||
const String *linkPgPath = strNewFmt("%s/%s", strZ(pgPath), strZ(linkName));
|
||||
const String *const linkPgPath = strNewFmt("%s/%s", strZ(pgPath), strZ(linkName));
|
||||
StorageInfo linkedInfo = storageInfoP(
|
||||
buildData->storagePg, linkPgPath, .followLink = true, .ignoreMissing = true);
|
||||
linkedInfo.name = linkName;
|
||||
@@ -1369,7 +1368,7 @@ manifestNewBuild(
|
||||
{
|
||||
for (unsigned int excludeIdx = 0; excludeIdx < strLstSize(excludeList); excludeIdx++)
|
||||
{
|
||||
const String *exclude = strNewFmt(MANIFEST_TARGET_PGDATA "/%s", strZ(strLstGet(excludeList, excludeIdx)));
|
||||
const String *const exclude = strNewFmt(MANIFEST_TARGET_PGDATA "/%s", strZ(strLstGet(excludeList, excludeIdx)));
|
||||
|
||||
// If the exclusions refers to the contents of a path
|
||||
if (strEndsWithZ(exclude, "/"))
|
||||
@@ -1393,9 +1392,9 @@ manifestNewBuild(
|
||||
// Build manifest
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
const String *const pgPath = storagePathP(storagePg, NULL);
|
||||
StorageInfo info = storageInfoP(storagePg, pgPath, .followLink = true);
|
||||
const StorageInfo info = storageInfoP(storagePg, pgPath, .followLink = true);
|
||||
|
||||
ManifestPath path =
|
||||
const ManifestPath path =
|
||||
{
|
||||
.name = MANIFEST_TARGET_PGDATA_STR,
|
||||
.mode = info.mode,
|
||||
@@ -1414,7 +1413,7 @@ manifestNewBuild(
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
|
||||
ManifestTarget target =
|
||||
const ManifestTarget target =
|
||||
{
|
||||
.name = MANIFEST_TARGET_PGDATA_STR,
|
||||
.path = pgPath,
|
||||
@@ -1458,7 +1457,7 @@ manifestNewBuild(
|
||||
|
||||
#ifdef DEBUG_MEM
|
||||
// Record the temp context size before the loop begins
|
||||
size_t sizeBegin = memContextSize(memContextCurrent());
|
||||
const size_t sizeBegin = memContextSize(memContextCurrent());
|
||||
#endif
|
||||
|
||||
while (fileIdx < manifestFileTotal(this))
|
||||
@@ -1469,8 +1468,8 @@ manifestNewBuild(
|
||||
if (regExpMatch(relationExp, filePathName))
|
||||
{
|
||||
// Get the filename (without path)
|
||||
const char *fileName = strBaseZ(filePathName);
|
||||
size_t fileNameSize = strlen(fileName);
|
||||
const char *const fileName = strBaseZ(filePathName);
|
||||
const size_t fileNameSize = strlen(fileName);
|
||||
|
||||
// Strip off the numeric part of the relation
|
||||
char relationFileId[sizeof(lastRelationFileId)];
|
||||
@@ -1493,7 +1492,7 @@ manifestNewBuild(
|
||||
if (strcmp(lastRelationFileId, relationFileId) != 0)
|
||||
{
|
||||
// Determine if the relation is unlogged
|
||||
String *relationInit = strNewFmt(
|
||||
String *const relationInit = strNewFmt(
|
||||
"%.*s%s_init", (int)(strSize(filePathName) - fileNameSize), strZ(filePathName), relationFileId);
|
||||
lastRelationFileIdUnlogged = manifestFileExists(this, relationInit);
|
||||
strFree(relationInit);
|
||||
@@ -1527,7 +1526,7 @@ manifestNewBuild(
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN void
|
||||
manifestBuildValidate(Manifest *this, bool delta, time_t copyStart, CompressType compressType)
|
||||
manifestBuildValidate(Manifest *const this, const bool delta, const time_t copyStart, const CompressType compressType)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(MANIFEST, this);
|
||||
@@ -1585,7 +1584,8 @@ manifestBuildValidate(Manifest *this, bool delta, time_t copyStart, CompressType
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN void
|
||||
manifestBuildIncr(Manifest *this, const Manifest *manifestPrior, BackupType type, const String *archiveStart)
|
||||
manifestBuildIncr(
|
||||
Manifest *const this, const Manifest *const manifestPrior, const BackupType type, const String *const archiveStart)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(MANIFEST, this);
|
||||
@@ -1680,7 +1680,7 @@ manifestBuildIncr(Manifest *this, const Manifest *manifestPrior, BackupType type
|
||||
}
|
||||
|
||||
// Find files to (possibly) reference in the prior manifest
|
||||
bool delta = varBool(this->pub.data.backupOptionDelta);
|
||||
const bool delta = varBool(this->pub.data.backupOptionDelta);
|
||||
|
||||
for (unsigned int fileIdx = 0; fileIdx < lstSize(this->pub.fileList); fileIdx++)
|
||||
{
|
||||
@@ -1973,7 +1973,7 @@ typedef struct ManifestLoadData
|
||||
// Helper to transform a variant that could be boolean or string into a string. If the boolean is false return NULL else return the
|
||||
// string. The boolean cannot be true.
|
||||
static const String *
|
||||
manifestOwnerGet(const Variant *owner)
|
||||
manifestOwnerGet(const Variant *const owner)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(VARIANT, owner);
|
||||
@@ -1993,7 +1993,7 @@ manifestOwnerGet(const Variant *owner)
|
||||
|
||||
// Helper to check the variant type of owner and duplicate (call in the containing context)
|
||||
static const Variant *
|
||||
manifestOwnerDefaultGet(const Variant *ownerDefault)
|
||||
manifestOwnerDefaultGet(const Variant *const ownerDefault)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(VARIANT, ownerDefault);
|
||||
@@ -2014,7 +2014,7 @@ manifestOwnerDefaultGet(const Variant *ownerDefault)
|
||||
}
|
||||
|
||||
static void
|
||||
manifestLoadCallback(void *callbackData, const String *const section, const String *const key, const String *const value)
|
||||
manifestLoadCallback(void *const callbackData, const String *const section, const String *const key, const String *const value)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM_P(VOID, callbackData);
|
||||
@@ -2404,7 +2404,7 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
|
||||
}
|
||||
|
||||
FN_EXTERN Manifest *
|
||||
manifestNewLoad(IoRead *read)
|
||||
manifestNewLoad(IoRead *const read)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(IO_READ, read);
|
||||
@@ -2463,8 +2463,8 @@ manifestNewLoad(IoRead *read)
|
||||
// Process path defaults
|
||||
for (unsigned int pathIdx = 0; pathIdx < manifestPathTotal(this); pathIdx++)
|
||||
{
|
||||
ManifestPath *path = lstGet(this->pub.pathList, pathIdx);
|
||||
ManifestLoadFound *found = lstGet(loadData.pathFoundList, pathIdx);
|
||||
ManifestPath *const path = lstGet(this->pub.pathList, pathIdx);
|
||||
const ManifestLoadFound *const found = lstGet(loadData.pathFoundList, pathIdx);
|
||||
|
||||
if (!found->group)
|
||||
path->group = manifestOwnerCache(this, manifestOwnerGet(loadData.pathGroupDefault));
|
||||
@@ -2511,7 +2511,7 @@ typedef struct ManifestSaveData
|
||||
|
||||
// Helper to convert the owner MCV to a default. If the input is NULL boolean false should be returned, else the owner string.
|
||||
static const Variant *
|
||||
manifestOwnerVar(const String *ownerDefault)
|
||||
manifestOwnerVar(const String *const ownerDefault)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STRING, ownerDefault);
|
||||
@@ -2956,7 +2956,7 @@ manifestSaveCallback(void *const callbackData, const String *const sectionNext,
|
||||
}
|
||||
|
||||
FN_EXTERN void
|
||||
manifestSave(Manifest *this, IoWrite *write)
|
||||
manifestSave(Manifest *const this, IoWrite *const write)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(MANIFEST, this);
|
||||
@@ -2993,7 +2993,7 @@ manifestSave(Manifest *this, IoWrite *write)
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
FN_EXTERN void
|
||||
manifestValidate(Manifest *this, bool strict)
|
||||
manifestValidate(Manifest *const this, const bool strict)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(MANIFEST, this);
|
||||
@@ -3004,7 +3004,7 @@ manifestValidate(Manifest *this, bool strict)
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
String *error = strNew();
|
||||
String *const error = strNew();
|
||||
|
||||
// Validate files
|
||||
for (unsigned int fileIdx = 0; fileIdx < manifestFileTotal(this); fileIdx++)
|
||||
@@ -3045,7 +3045,7 @@ manifestValidate(Manifest *this, bool strict)
|
||||
File functions and getters/setters
|
||||
***********************************************************************************************************************************/
|
||||
static ManifestFilePack **
|
||||
manifestFilePackFindInternal(const Manifest *this, const String *name)
|
||||
manifestFilePackFindInternal(const Manifest *const this, const String *const name)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -3064,7 +3064,7 @@ manifestFilePackFindInternal(const Manifest *this, const String *name)
|
||||
}
|
||||
|
||||
const ManifestFilePack *
|
||||
manifestFilePackFind(const Manifest *this, const String *name)
|
||||
manifestFilePackFind(const Manifest *const this, const String *const name)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -3078,7 +3078,7 @@ manifestFilePackFind(const Manifest *this, const String *name)
|
||||
}
|
||||
|
||||
FN_EXTERN void
|
||||
manifestFileRemove(const Manifest *this, const String *name)
|
||||
manifestFileRemove(const Manifest *const this, const String *const name)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -3120,7 +3120,7 @@ manifestFileUpdate(Manifest *const this, const ManifestFile *const file)
|
||||
Link functions and getters/setters
|
||||
***********************************************************************************************************************************/
|
||||
FN_EXTERN const ManifestLink *
|
||||
manifestLinkFind(const Manifest *this, const String *name)
|
||||
manifestLinkFind(const Manifest *const this, const String *const name)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -3130,7 +3130,7 @@ manifestLinkFind(const Manifest *this, const String *name)
|
||||
ASSERT(this != NULL);
|
||||
ASSERT(name != NULL);
|
||||
|
||||
const ManifestLink *result = lstFind(this->pub.linkList, &name);
|
||||
const ManifestLink *const result = lstFind(this->pub.linkList, &name);
|
||||
|
||||
if (result == NULL)
|
||||
THROW_FMT(AssertError, "unable to find '%s' in manifest link list", strZ(name));
|
||||
@@ -3139,7 +3139,7 @@ manifestLinkFind(const Manifest *this, const String *name)
|
||||
}
|
||||
|
||||
FN_EXTERN void
|
||||
manifestLinkRemove(const Manifest *this, const String *name)
|
||||
manifestLinkRemove(const Manifest *const this, const String *const name)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -3156,7 +3156,7 @@ manifestLinkRemove(const Manifest *this, const String *name)
|
||||
}
|
||||
|
||||
FN_EXTERN void
|
||||
manifestLinkUpdate(const Manifest *this, const String *name, const String *destination)
|
||||
manifestLinkUpdate(const Manifest *const this, const String *const name, const String *const destination)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -3168,7 +3168,7 @@ manifestLinkUpdate(const Manifest *this, const String *name, const String *desti
|
||||
ASSERT(name != NULL);
|
||||
ASSERT(destination != NULL);
|
||||
|
||||
ManifestLink *link = (ManifestLink *)manifestLinkFind(this, name);
|
||||
ManifestLink *const link = (ManifestLink *)manifestLinkFind(this, name);
|
||||
|
||||
MEM_CONTEXT_BEGIN(lstMemContext(this->pub.linkList))
|
||||
{
|
||||
@@ -3184,7 +3184,7 @@ manifestLinkUpdate(const Manifest *this, const String *name, const String *desti
|
||||
Path functions and getters/setters
|
||||
***********************************************************************************************************************************/
|
||||
FN_EXTERN const ManifestPath *
|
||||
manifestPathFind(const Manifest *this, const String *name)
|
||||
manifestPathFind(const Manifest *const this, const String *const name)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -3194,7 +3194,7 @@ manifestPathFind(const Manifest *this, const String *name)
|
||||
ASSERT(this != NULL);
|
||||
ASSERT(name != NULL);
|
||||
|
||||
const ManifestPath *result = lstFind(this->pub.pathList, &name);
|
||||
const ManifestPath *const result = lstFind(this->pub.pathList, &name);
|
||||
|
||||
if (result == NULL)
|
||||
THROW_FMT(AssertError, "unable to find '%s' in manifest path list", strZ(name));
|
||||
@@ -3203,7 +3203,7 @@ manifestPathFind(const Manifest *this, const String *name)
|
||||
}
|
||||
|
||||
FN_EXTERN String *
|
||||
manifestPathPg(const String *manifestPath)
|
||||
manifestPathPg(const String *const manifestPath)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STRING, manifestPath);
|
||||
@@ -3233,7 +3233,7 @@ manifestPathPg(const String *manifestPath)
|
||||
Target functions and getters/setters
|
||||
***********************************************************************************************************************************/
|
||||
FN_EXTERN const ManifestTarget *
|
||||
manifestTargetFind(const Manifest *this, const String *name)
|
||||
manifestTargetFind(const Manifest *const this, const String *const name)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -3243,7 +3243,7 @@ manifestTargetFind(const Manifest *this, const String *name)
|
||||
ASSERT(this != NULL);
|
||||
ASSERT(name != NULL);
|
||||
|
||||
const ManifestTarget *result = lstFind(this->pub.targetList, &name);
|
||||
const ManifestTarget *const result = lstFind(this->pub.targetList, &name);
|
||||
|
||||
if (result == NULL)
|
||||
THROW_FMT(AssertError, "unable to find '%s' in manifest target list", strZ(name));
|
||||
@@ -3252,7 +3252,7 @@ manifestTargetFind(const Manifest *this, const String *name)
|
||||
}
|
||||
|
||||
FN_EXTERN String *
|
||||
manifestTargetPath(const Manifest *this, const ManifestTarget *target)
|
||||
manifestTargetPath(const Manifest *const this, const ManifestTarget *const target)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -3267,11 +3267,11 @@ manifestTargetPath(const Manifest *this, const ManifestTarget *target)
|
||||
FUNCTION_TEST_RETURN(STRING, strDup(target->path));
|
||||
|
||||
// Construct it from the base pg path and a relative path
|
||||
String *result = NULL;
|
||||
String *result;
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
String *pgPath = strCat(strNew(), strPath(manifestPathPg(target->name)));
|
||||
String *const pgPath = strCat(strNew(), strPath(manifestPathPg(target->name)));
|
||||
|
||||
if (strSize(pgPath) != 0)
|
||||
strCatZ(pgPath, "/");
|
||||
@@ -3290,7 +3290,7 @@ manifestTargetPath(const Manifest *this, const ManifestTarget *target)
|
||||
}
|
||||
|
||||
FN_EXTERN void
|
||||
manifestTargetRemove(const Manifest *this, const String *name)
|
||||
manifestTargetRemove(const Manifest *const this, const String *const name)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -3307,7 +3307,7 @@ manifestTargetRemove(const Manifest *this, const String *name)
|
||||
}
|
||||
|
||||
FN_EXTERN void
|
||||
manifestTargetUpdate(const Manifest *this, const String *name, const String *path, const String *file)
|
||||
manifestTargetUpdate(const Manifest *const this, const String *const name, const String *const path, const String *const file)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -3320,7 +3320,7 @@ manifestTargetUpdate(const Manifest *this, const String *name, const String *pat
|
||||
ASSERT(name != NULL);
|
||||
ASSERT(path != NULL);
|
||||
|
||||
ManifestTarget *target = (ManifestTarget *)manifestTargetFind(this, name);
|
||||
ManifestTarget *const target = (ManifestTarget *)manifestTargetFind(this, name);
|
||||
|
||||
ASSERT((target->file == NULL && file == NULL) || (target->file != NULL && file != NULL));
|
||||
|
||||
@@ -3341,7 +3341,7 @@ manifestTargetUpdate(const Manifest *this, const String *name, const String *pat
|
||||
Getters/Setters
|
||||
***********************************************************************************************************************************/
|
||||
FN_EXTERN void
|
||||
manifestBackupLabelSet(Manifest *this, const String *backupLabel)
|
||||
manifestBackupLabelSet(Manifest *const this, const String *const backupLabel)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(MANIFEST, this);
|
||||
@@ -3410,7 +3410,8 @@ manifestLoadFileCallback(void *const data, const unsigned int try)
|
||||
}
|
||||
|
||||
FN_EXTERN Manifest *
|
||||
manifestLoadFile(const Storage *storage, const String *fileName, CipherType cipherType, const String *cipherPass)
|
||||
manifestLoadFile(
|
||||
const Storage *const storage, const String *const fileName, const CipherType cipherType, const String *const cipherPass)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE, storage);
|
||||
@@ -3434,7 +3435,7 @@ manifestLoadFile(const Storage *storage, const String *fileName, CipherType ciph
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
const char *fileNamePath = strZ(storagePathP(storage, fileName));
|
||||
const char *const fileNamePath = strZ(storagePathP(storage, fileName));
|
||||
|
||||
infoLoad(
|
||||
strNewFmt("unable to load backup manifest file '%s' or '%s" INFO_COPY_EXT "'", fileNamePath, fileNamePath),
|
||||
|
||||
Reference in New Issue
Block a user