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

Various comment and assert fixes in the info modules.

This commit is contained in:
David Steele 2019-04-12 18:13:01 -04:00
parent 65a26ac4ba
commit 39ed4f763b
5 changed files with 20 additions and 12 deletions

View File

@ -33,7 +33,7 @@ Object type
***********************************************************************************************************************************/
struct Info
{
MemContext *memContext; // Context that contains the info
MemContext *memContext; // Mem context
String *fileName; // Full path name of the file
Ini *ini; // Parsed file contents
const String *cipherPass; // Cipher passphrase if set
@ -206,11 +206,13 @@ infoNew(const Storage *storage, const String *fileName, CipherType cipherType, c
FUNCTION_TEST_PARAM(STRING, cipherPass);
FUNCTION_LOG_END();
ASSERT(storage != NULL);
ASSERT(fileName != NULL);
ASSERT(cipherType == cipherTypeNone || cipherPass != NULL);
Info *this = NULL;
MEM_CONTEXT_NEW_BEGIN("info")
MEM_CONTEXT_NEW_BEGIN("Info")
{
// Create object
this = memNew(sizeof(Info));
@ -263,7 +265,6 @@ infoNew(const Storage *storage, const String *fileName, CipherType cipherType, c
}
MEM_CONTEXT_NEW_END();
// Return buffer
FUNCTION_LOG_RETURN(INFO, this);
}

View File

@ -20,7 +20,7 @@ Object type
***********************************************************************************************************************************/
struct InfoArchive
{
MemContext *memContext; // Context that contains the InfoArchive
MemContext *memContext; // Mem context
InfoPg *infoPg; // Contents of the DB data
String *archiveId; // Archive id for the current PG version
};
@ -40,11 +40,13 @@ infoArchiveNew(const Storage *storage, const String *fileName, bool ignoreMissin
FUNCTION_TEST_PARAM(STRING, cipherPass);
FUNCTION_LOG_END();
ASSERT(storage != NULL);
ASSERT(fileName != NULL);
ASSERT(cipherType == cipherTypeNone || cipherPass != NULL);
InfoArchive *this = NULL;
MEM_CONTEXT_NEW_BEGIN("infoArchive")
MEM_CONTEXT_NEW_BEGIN("InfoArchive")
{
// Create object
this = memNew(sizeof(InfoArchive));
@ -73,7 +75,6 @@ infoArchiveNew(const Storage *storage, const String *fileName, bool ignoreMissin
}
MEM_CONTEXT_NEW_END();
// Return buffer
FUNCTION_LOG_RETURN(INFO_ARCHIVE, this);
}

View File

@ -37,7 +37,7 @@ Object type
***********************************************************************************************************************************/
struct InfoBackup
{
MemContext *memContext; // Context that contains the InfoBackup
MemContext *memContext; // Mem context
InfoPg *infoPg; // Contents of the DB data
List *backup; // List of current backups and their associated data
};
@ -51,17 +51,20 @@ InfoBackup *
infoBackupNew(const Storage *storage, const String *fileName, bool ignoreMissing, CipherType cipherType, const String *cipherPass)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(STORAGE, storage);
FUNCTION_LOG_PARAM(STRING, fileName);
FUNCTION_LOG_PARAM(BOOL, ignoreMissing);
FUNCTION_LOG_PARAM(ENUM, cipherType);
FUNCTION_TEST_PARAM(STRING, cipherPass);
FUNCTION_LOG_END();
ASSERT(storage != NULL);
ASSERT(fileName != NULL);
ASSERT(cipherType == cipherTypeNone || cipherPass != NULL);
InfoBackup *this = NULL;
MEM_CONTEXT_NEW_BEGIN("infoBackup")
MEM_CONTEXT_NEW_BEGIN("InfoBackup")
{
// Create object
this = memNew(sizeof(InfoBackup));
@ -139,7 +142,6 @@ infoBackupNew(const Storage *storage, const String *fileName, bool ignoreMissing
}
MEM_CONTEXT_NEW_END();
// Return buffer
FUNCTION_LOG_RETURN(INFO_BACKUP, this);
}

View File

@ -4,6 +4,9 @@ Manifest Info Handler
#ifndef INFO_INFOMANIFEST_H
#define INFO_INFOMANIFEST_H
/***********************************************************************************************************************************
Constants
***********************************************************************************************************************************/
#define INFO_MANIFEST_KEY_BACKUP_ARCHIVE_START "backup-archive-start"
STRING_DECLARE(INFO_MANIFEST_KEY_BACKUP_ARCHIVE_START_STR);
#define INFO_MANIFEST_KEY_BACKUP_ARCHIVE_STOP "backup-archive-stop"

View File

@ -36,7 +36,7 @@ Object type
***********************************************************************************************************************************/
struct InfoPg
{
MemContext *memContext; // Context that contains the infoPg
MemContext *memContext; // Mem context
List *history; // A list of InfoPgData
unsigned int historyCurrent; // Index of the current history item
Info *info; // Info contents
@ -61,11 +61,13 @@ infoPgNew(const Storage *storage, const String *fileName, InfoPgType type, Ciphe
FUNCTION_TEST_PARAM(STRING, cipherPass);
FUNCTION_LOG_END();
ASSERT(storage != NULL);
ASSERT(fileName != NULL);
ASSERT(cipherType == cipherTypeNone || cipherPass != NULL);
InfoPg *this = NULL;
MEM_CONTEXT_NEW_BEGIN("infoPg")
MEM_CONTEXT_NEW_BEGIN("InfoPg")
{
// Create object
this = memNew(sizeof(InfoPg));
@ -136,7 +138,6 @@ infoPgNew(const Storage *storage, const String *fileName, InfoPgType type, Ciphe
}
MEM_CONTEXT_NEW_END();
// Return buffer
FUNCTION_LOG_RETURN(INFO_PG, this);
}