1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-09-16 09:06:18 +02:00

Fix non-compliant formatting for function declarations.

Per review by Cynthia Shang.
This commit is contained in:
David Steele
2018-01-31 18:22:25 -05:00
parent b4d434b41c
commit 298b33988c
43 changed files with 130 additions and 61 deletions

View File

@@ -127,6 +127,14 @@
<release-item>
<p>Refactor code to make valgrind happy.</p>
</release-item>
<release-item>
<release-item-contributor-list>
<release-item-ideator id="shang.cynthia"/>
</release-item-contributor-list>
<p>Fix non-compliant formatting for function declarations.</p>
</release-item>
</release-development-list>
</release-core-list>

View File

@@ -15,7 +15,8 @@ static bool cipherInitDone = false;
/***********************************************************************************************************************************
Initialize ciphers
***********************************************************************************************************************************/
void cipherInit()
void
cipherInit()
{
if (!cipherInitDone)
{
@@ -29,7 +30,8 @@ void cipherInit()
/***********************************************************************************************************************************
Have the ciphers been initialized?
***********************************************************************************************************************************/
bool cipherIsInit()
bool
cipherIsInit()
{
return cipherInitDone;
}
@@ -37,7 +39,8 @@ bool cipherIsInit()
/***********************************************************************************************************************************
Free ciphers
***********************************************************************************************************************************/
void cipherFree()
void
cipherFree()
{
if (cipherInitDone)
{

View File

@@ -11,7 +11,8 @@ Common Command Routines
/***********************************************************************************************************************************
Begin the command
***********************************************************************************************************************************/
void cmdBegin()
void
cmdBegin()
{
MEM_CONTEXT_TEMP_BEGIN()
{
@@ -65,7 +66,8 @@ void cmdBegin()
/***********************************************************************************************************************************
End the command
***********************************************************************************************************************************/
void cmdEnd(int code)
void
cmdEnd(int code)
{
MEM_CONTEXT_TEMP_BEGIN()
{

View File

@@ -170,7 +170,8 @@ errorInternalJump()
/***********************************************************************************************************************************
Begin the try block
***********************************************************************************************************************************/
bool errorInternalTry(const char *fileName, int fileLine)
bool
errorInternalTry(const char *fileName, int fileLine)
{
// If try total has been exceeded then throw an error
if (errorContext.tryTotal >= ERROR_TRY_MAX)
@@ -190,7 +191,8 @@ bool errorInternalTry(const char *fileName, int fileLine)
/***********************************************************************************************************************************
Propogate the error up so it can be caught
***********************************************************************************************************************************/
void errorInternalPropagate()
void
errorInternalPropagate()
{
// Mark the error as uncaught
errorContext.tryList[errorContext.tryTotal].uncaught = true;
@@ -212,7 +214,8 @@ void errorInternalPropagate()
/***********************************************************************************************************************************
Process the error through each try and state
***********************************************************************************************************************************/
bool errorInternalProcess(bool catch)
bool
errorInternalProcess(bool catch)
{
// If a catch statement then return
if (catch)
@@ -249,7 +252,8 @@ bool errorInternalProcess(bool catch)
/***********************************************************************************************************************************
Throw an error
***********************************************************************************************************************************/
void errorInternalThrow(const ErrorType *errorType, const char *fileName, int fileLine, const char *format, ...)
void
errorInternalThrow(const ErrorType *errorType, const char *fileName, int fileLine, const char *format, ...)
{
// Setup error data
errorContext.error.errorType = errorType;
@@ -273,7 +277,8 @@ void errorInternalThrow(const ErrorType *errorType, const char *fileName, int fi
/***********************************************************************************************************************************
Throw an error
***********************************************************************************************************************************/
void errorInternalThrowSys(int result, const ErrorType *errorType, const char *fileName, int fileLine, const char *format, ...)
void
errorInternalThrowSys(int result, const ErrorType *errorType, const char *fileName, int fileLine, const char *format, ...)
{
// Only error if the result is not 0
if (result != 0)

View File

@@ -133,7 +133,8 @@ errorTypeParent(const ErrorType *errorType)
/***********************************************************************************************************************************
Does the child error type extend the parent error type?
***********************************************************************************************************************************/
bool errorTypeExtends(const ErrorType *child, const ErrorType *parent)
bool
errorTypeExtends(const ErrorType *child, const ErrorType *parent)
{
// Search for the parent
for (; child && errorTypeParent(child) != child; child = (ErrorType *)errorTypeParent(child))

View File

@@ -68,7 +68,8 @@ iniGetInternal(const Ini *this, const String *section, const String *key)
/***********************************************************************************************************************************
Get an ini value -- error if it does not exist
***********************************************************************************************************************************/
const Variant *iniGet(const Ini *this, const String *section, const String *key)
const Variant *
iniGet(const Ini *this, const String *section, const String *key)
{
// Get the value
const Variant *result = iniGetInternal(this, section, key);

View File

@@ -60,7 +60,8 @@ MemContext *contextCurrent = &contextTop;
/***********************************************************************************************************************************
Wrapper around malloc()
***********************************************************************************************************************************/
static void *memAllocInternal(size_t size, bool zero)
static void *
memAllocInternal(size_t size, bool zero)
{
// Allocate memory
void *buffer = malloc(size);
@@ -80,7 +81,8 @@ static void *memAllocInternal(size_t size, bool zero)
/***********************************************************************************************************************************
Wrapper around realloc()
***********************************************************************************************************************************/
static void *memReAllocInternal(void *bufferOld, size_t sizeOld, size_t sizeNew, bool zeroNew)
static void *
memReAllocInternal(void *bufferOld, size_t sizeOld, size_t sizeNew, bool zeroNew)
{
// Allocate memory
void *bufferNew = realloc(bufferOld, sizeNew);
@@ -100,7 +102,8 @@ static void *memReAllocInternal(void *bufferOld, size_t sizeOld, size_t sizeNew,
/***********************************************************************************************************************************
Wrapper around free()
***********************************************************************************************************************************/
static void memFreeInternal(void *buffer)
static void
memFreeInternal(void *buffer)
{
// Error if pointer is null
if(!buffer)

View File

@@ -31,7 +31,8 @@ regExpError(int error)
/***********************************************************************************************************************************
New regular expression handler
***********************************************************************************************************************************/
RegExp *regExpNew(const String *expression)
RegExp *
regExpNew(const String *expression)
{
RegExp *this = NULL;
@@ -60,7 +61,8 @@ RegExp *regExpNew(const String *expression)
/***********************************************************************************************************************************
Match on a regular expression
***********************************************************************************************************************************/
bool regExpMatch(RegExp *this, const String *string)
bool
regExpMatch(RegExp *this, const String *string)
{
// Test for a match
int result = regexec(&this->regExp, strPtr(string), 0, NULL, 0);
@@ -75,7 +77,8 @@ bool regExpMatch(RegExp *this, const String *string)
/***********************************************************************************************************************************
Free regular expression
***********************************************************************************************************************************/
void regExpFree(RegExp *this)
void
regExpFree(RegExp *this)
{
if (this != NULL)
{
@@ -87,7 +90,8 @@ void regExpFree(RegExp *this)
/***********************************************************************************************************************************
Match a regular expression in one call for brevity
***********************************************************************************************************************************/
bool regExpMatchOne(const String *expression, const String *string)
bool
regExpMatchOne(const String *expression, const String *string)
{
bool result = false;
RegExp *regExp = regExpNew(expression);

View File

@@ -270,7 +270,8 @@ strLstSort(StringList *this, SortOrder sortOrder)
/***********************************************************************************************************************************
Wrapper for lstFree()
***********************************************************************************************************************************/
void strLstFree(StringList *this)
void
strLstFree(StringList *this)
{
if (this != NULL)
lstFree((List *)this);

View File

@@ -86,7 +86,8 @@ varLstSize(const VariantList *this)
/***********************************************************************************************************************************
Wrapper for lstFree()
***********************************************************************************************************************************/
void varLstFree(VariantList *this)
void
varLstFree(VariantList *this)
{
lstFree((List *)this);
}

View File

@@ -14,7 +14,8 @@ Main
#include "perl/exec.h"
#include "version.h"
int main(int argListSize, const char *argList[])
int
main(int argListSize, const char *argList[])
{
TRY_BEGIN()
{

View File

@@ -27,7 +27,8 @@ Constants used to build perl options
/***********************************************************************************************************************************
Build list of perl options to use for exec
***********************************************************************************************************************************/
StringList *perlCommand()
StringList *
perlCommand()
{
// Begin arg list for perl exec
StringList *perlArgList = strLstNew();
@@ -175,7 +176,8 @@ StringList *perlCommand()
/***********************************************************************************************************************************
Exec supplied Perl options
***********************************************************************************************************************************/
void perlExec(StringList *perlArgList)
void
perlExec(StringList *perlArgList)
{
// Exec perl with supplied arguments
execvp(strPtr(strLstGet(perlArgList, 0)), (char **)strLstPtr(perlArgList));

View File

@@ -82,7 +82,8 @@ storageReadError(ssize_t actualBytes, const String *file)
/***********************************************************************************************************************************
Read from storage into a buffer
***********************************************************************************************************************************/
Buffer *storageGet(const Storage *storage, const String *fileExp, bool ignoreMissing)
Buffer *
storageGet(const Storage *storage, const String *fileExp, bool ignoreMissing)
{
Buffer volatile *result = NULL;
volatile int fileHandle = -1;
@@ -156,7 +157,8 @@ Buffer *storageGet(const Storage *storage, const String *fileExp, bool ignoreMis
/***********************************************************************************************************************************
Get a list of files from a directory
***********************************************************************************************************************************/
StringList *storageList(const Storage *storage, const String *pathExp, const String *expression, bool ignoreMissing)
StringList *
storageList(const Storage *storage, const String *pathExp, const String *expression, bool ignoreMissing)
{
StringList *result = NULL;
@@ -230,7 +232,8 @@ StringList *storageList(const Storage *storage, const String *pathExp, const Str
/***********************************************************************************************************************************
Get the absolute path in the storage
***********************************************************************************************************************************/
String *storagePath(const Storage *storage, const String *pathExp)
String *
storagePath(const Storage *storage, const String *pathExp)
{
String *result = NULL;
@@ -341,7 +344,8 @@ storageWriteError(ssize_t actualBytes, size_t expectedBytes, const String *file)
/***********************************************************************************************************************************
Write a buffer to storage
***********************************************************************************************************************************/
void storagePut(const Storage *storage, const String *fileExp, const Buffer *buffer)
void
storagePut(const Storage *storage, const String *fileExp, const Buffer *buffer)
{
volatile int fileHandle = -1;
String *file = NULL;

View File

@@ -8,7 +8,8 @@ Test Archive Push Command
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("walStatus()"))

View File

@@ -18,7 +18,8 @@ Data for testing
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("blockCipherNew() and blockCipherFree()"))

View File

@@ -5,7 +5,8 @@ Test Random
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("randomBytes()"))

View File

@@ -10,7 +10,8 @@ Test Common Command Routines
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("cmdBegin() and cmdEnd()"))

View File

@@ -5,7 +5,8 @@ Test Binary to String Encode/Decode
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("base64"))

View File

@@ -9,7 +9,8 @@ volatile int testTryRecurseTotal = 0;
bool testTryRecurseCatch = false;
bool testTryRecurseFinally = false;
void testTryRecurse()
void
testTryRecurse()
{
TRY_BEGIN()
{
@@ -32,7 +33,8 @@ void testTryRecurse()
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("check that try stack is initialized correctly"))

View File

@@ -6,7 +6,8 @@ Test Exit Routines
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("exitSafe()"))

View File

@@ -5,7 +5,8 @@ Test Ini
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("iniNew() and iniFree()"))

View File

@@ -10,7 +10,8 @@ Test Log Handler
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("logLevelEnum() and logLevelStr()"))

View File

@@ -7,7 +7,8 @@ testFree - test callback function
***********************************************************************************************************************************/
MemContext *memContextCallbackArgument = NULL;
void testFree(MemContext *this)
void
testFree(MemContext *this)
{
TEST_RESULT_INT(this->state, memContextStateFreeing, "state should be freeing before memContextFree() in callback");
memContextFree(this);
@@ -26,7 +27,8 @@ void testFree(MemContext *this)
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("memAllocInternal(), memReAllocInternal(), and memFreeInternal()"))

View File

@@ -5,7 +5,8 @@ Test Regular Expression Handler
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("regExpNew(), regExpMatch(), and regExpFree()"))

View File

@@ -5,7 +5,8 @@ Test Time Management
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("timeUSec()"))

View File

@@ -5,7 +5,8 @@ Test Buffers
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("bufNew(), bufNewStr(), bufSize(), bufPtr(), and bufFree()"))

View File

@@ -5,7 +5,8 @@ Test Key Value Data Type
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("kvNew() and kvFree()"))

View File

@@ -23,7 +23,8 @@ testComparator(const void *item1, const void *item2)
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("lstNew() and lstFree()"))

View File

@@ -5,7 +5,8 @@ Test String Lists
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("strLstNew(), strLstAdd, strLstGet(), strLstSize(), and strLstFree()"))

View File

@@ -6,7 +6,8 @@ Test Strings
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("strNew(), strNewBuf(), strNewN(), and strFree()"))

View File

@@ -1,7 +1,8 @@
/***********************************************************************************************************************************
Test Types
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("test int size"))

View File

@@ -5,7 +5,8 @@ Test Variant Lists
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("varLstNew(), varLstAdd(), varLstSize(), varLstGet(), and varListFree()"))

View File

@@ -5,7 +5,8 @@ Test Variant Data Type
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("bool"))

View File

@@ -5,7 +5,8 @@ Test Wait Handler
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("waitNew(), waitMore, and waitFree()"))

View File

@@ -5,7 +5,8 @@ Test Configuration Commands and Options
/***********************************************************************************************************************************
Test run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// Static tests against known values -- these may break as options change so will need to be kept up to date. The tests have
// generally been selected to favor values that are not expected to change but adjustments are welcome as long as the type of

View File

@@ -5,7 +5,8 @@ Test Configuration Command and Option Definition
/***********************************************************************************************************************************
Test run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// Static tests against known values -- these may break as options change so will need to be kept up to date. The tests have
// generally been selected to favor values that are not expected to change but adjustments are welcome as long as the type of

View File

@@ -6,7 +6,8 @@ Test Configuration Load
/***********************************************************************************************************************************
Test run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("cfgLoad()"))

View File

@@ -12,7 +12,8 @@ Test Configuration Parse
/***********************************************************************************************************************************
Test run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("configParse()"))

View File

@@ -8,7 +8,8 @@ Test Help Command
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// Program name a version are used multiple times
const char *helpVersion = PGBACKREST_NAME " " PGBACKREST_VERSION;

View File

@@ -12,7 +12,8 @@ Test Perl Exec
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("perlCommand()"))

View File

@@ -10,7 +10,8 @@ Page data for testing -- use 8192 for page size since this is the most common va
// GCC doesn't like this elements of this array being used as both char * and struct * so wrap it in a function to disable the
// optimizations that cause warnings
unsigned char *testPage(int pageIdx)
unsigned char *
testPage(int pageIdx)
{
static unsigned char testPageBuffer[TEST_PAGE_TOTAL][TEST_PAGE_SIZE];
return testPageBuffer[pageIdx];
@@ -19,7 +20,8 @@ unsigned char *testPage(int pageIdx)
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("pageChecksum()"))

View File

@@ -5,7 +5,8 @@ Test Storage Helper
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("storageLocal()"))

View File

@@ -21,7 +21,8 @@ storageTestPathExpression(const String *expression, const String *path)
/***********************************************************************************************************************************
Test Run
***********************************************************************************************************************************/
void testRun()
void
testRun()
{
// *****************************************************************************************************************************
if (testBegin("storageNew()"))