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

Add const to inline functions where appropriate.

This lets the compiler know that these variables are not modified which should lead to better optimization.

Smart compilers should be able to figure this out on their own, but marking parameters const is still good for documentation.
This commit is contained in:
David Steele 2021-04-20 18:43:16 -04:00
parent ed0d48f52c
commit fd69357302
46 changed files with 147 additions and 147 deletions

View File

@ -65,7 +65,7 @@ void execOpen(Exec *this);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
execFree(Exec *this)
execFree(Exec *const this)
{
objFree(this);
}

View File

@ -24,7 +24,7 @@ Functions
***********************************************************************************************************************************/
// Move to a new parent mem context
__attribute__((always_inline)) static inline Ini *
iniMove(Ini *this, MemContext *parentNew)
iniMove(Ini *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -61,7 +61,7 @@ StringList *iniSectionList(const Ini *this);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
iniFree(Ini *this)
iniFree(Ini *const this)
{
objFree(this);
}

View File

@ -38,7 +38,7 @@ Functions
***********************************************************************************************************************************/
// Move to a new parent mem context
__attribute__((always_inline)) static inline IoClient *
ioClientMove(IoClient *this, MemContext *parentNew)
ioClientMove(IoClient *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -54,7 +54,7 @@ ioClientOpen(IoClient *const this)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
ioClientFree(IoClient *this)
ioClientFree(IoClient *const this)
{
objFree(this);
}

View File

@ -14,14 +14,14 @@ bool fdReady(int fd, bool read, bool write, TimeMSec timeout);
// Wait until the file descriptor is ready to read or timeout
__attribute__((always_inline)) static inline bool
fdReadyRead(int fd, TimeMSec timeout)
fdReadyRead(const int fd, const TimeMSec timeout)
{
return fdReady(fd, true, false, timeout);
}
// Wait until the file descriptor is ready to write or timeout
__attribute__((always_inline)) static inline bool
fdReadyWrite(int fd, TimeMSec timeout)
fdReadyWrite(const int fd, const TimeMSec timeout)
{
return fdReady(fd, false, true, timeout);
}

View File

@ -38,7 +38,7 @@ ioFilterType(const IoFilter *const this)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
ioFilterFree(IoFilter *this)
ioFilterFree(IoFilter *const this)
{
objFree(this);
}

View File

@ -99,7 +99,7 @@ void ioFilterGroupClose(IoFilterGroup *this);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
ioFilterGroupFree(IoFilterGroup *this)
ioFilterGroupFree(IoFilterGroup *const this)
{
objFree(this);
}

View File

@ -53,7 +53,7 @@ typedef struct HttpClientPub
} HttpClientPub;
__attribute__((always_inline)) static inline TimeMSec
httpClientTimeout(const HttpClient *this)
httpClientTimeout(const HttpClient *const this)
{
return THIS_PUB(HttpClient)->timeout;
}

View File

@ -34,7 +34,7 @@ StringList *httpHeaderList(const HttpHeader *this);
// Move to a new parent mem context
__attribute__((always_inline)) static inline HttpHeader *
httpHeaderMove(HttpHeader *this, MemContext *parentNew)
httpHeaderMove(HttpHeader *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -49,7 +49,7 @@ bool httpHeaderRedact(const HttpHeader *this, const String *key);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
httpHeaderFree(HttpHeader *this)
httpHeaderFree(HttpHeader *const this)
{
objFree(this);
}

View File

@ -60,7 +60,7 @@ HttpQuery *httpQueryMerge(HttpQuery *this, const HttpQuery *query);
// Move to a new parent mem context
__attribute__((always_inline)) static inline HttpQuery *
httpQueryMove(HttpQuery *this, MemContext *parentNew)
httpQueryMove(HttpQuery *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -87,7 +87,7 @@ String *httpQueryRender(const HttpQuery *this, HttpQueryRenderParam param);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
httpQueryFree(HttpQuery *this)
httpQueryFree(HttpQuery *const this)
{
objFree(this);
}

View File

@ -89,28 +89,28 @@ typedef struct HttpRequestPub
// Request path
__attribute__((always_inline)) static inline const String *
httpRequestPath(const HttpRequest *this)
httpRequestPath(const HttpRequest *const this)
{
return THIS_PUB(HttpRequest)->path;
}
// Request query
__attribute__((always_inline)) static inline const HttpQuery *
httpRequestQuery(const HttpRequest *this)
httpRequestQuery(const HttpRequest *const this)
{
return THIS_PUB(HttpRequest)->query;
}
// Request headers
__attribute__((always_inline)) static inline const HttpHeader *
httpRequestHeader(const HttpRequest *this)
httpRequestHeader(const HttpRequest *const this)
{
return THIS_PUB(HttpRequest)->header;
}
// Request verb
__attribute__((always_inline)) static inline const String *
httpRequestVerb(const HttpRequest *this)
httpRequestVerb(const HttpRequest *const this)
{
return THIS_PUB(HttpRequest)->verb;
}
@ -126,7 +126,7 @@ void httpRequestError(const HttpRequest *this, HttpResponse *response) __attribu
// Move to a new parent mem context
__attribute__((always_inline)) static inline HttpRequest *
httpRequestMove(HttpRequest *this, MemContext *parentNew)
httpRequestMove(HttpRequest *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -135,7 +135,7 @@ httpRequestMove(HttpRequest *this, MemContext *parentNew)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
httpRequestFree(HttpRequest *this)
httpRequestFree(HttpRequest *const this)
{
objFree(this);
}

View File

@ -44,28 +44,28 @@ typedef struct HttpResponsePub
// Read interface used to get the response content. This is intended for reading content that may be very large and will not be held
// in memory all at once. If the content must be loaded completely for processing (e.g. XML) then httpResponseContent() is simpler.
__attribute__((always_inline)) static inline IoRead *
httpResponseIoRead(HttpResponse *this)
httpResponseIoRead(HttpResponse *const this)
{
return THIS_PUB(HttpResponse)->contentRead;
}
// Response code
__attribute__((always_inline)) static inline unsigned int
httpResponseCode(const HttpResponse *this)
httpResponseCode(const HttpResponse *const this)
{
return THIS_PUB(HttpResponse)->code;
}
// Response headers
__attribute__((always_inline)) static inline const HttpHeader *
httpResponseHeader(const HttpResponse *this)
httpResponseHeader(const HttpResponse *const this)
{
return THIS_PUB(HttpResponse)->header;
}
// Response reason
__attribute__((always_inline)) static inline const String *
httpResponseReason(const HttpResponse *this)
httpResponseReason(const HttpResponse *const this)
{
return THIS_PUB(HttpResponse)->reason;
}
@ -75,7 +75,7 @@ Functions
***********************************************************************************************************************************/
// Is this response code OK, i.e. 2XX?
__attribute__((always_inline)) static inline bool
httpResponseCodeOk(const HttpResponse *this)
httpResponseCodeOk(const HttpResponse *const this)
{
return httpResponseCode(this) / 100 == 2;
}
@ -85,7 +85,7 @@ const Buffer *httpResponseContent(HttpResponse *this);
// Move to a new parent mem context
__attribute__((always_inline)) static inline HttpResponse *
httpResponseMove(HttpResponse *this, MemContext *parentNew)
httpResponseMove(HttpResponse *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -94,7 +94,7 @@ httpResponseMove(HttpResponse *this, MemContext *parentNew)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
httpResponseFree(HttpResponse *this)
httpResponseFree(HttpResponse *const this)
{
objFree(this);
}

View File

@ -27,7 +27,7 @@ Functions
***********************************************************************************************************************************/
// Move to a new parent mem context
__attribute__((always_inline)) static inline HttpSession *
httpSessionMove(HttpSession *this, MemContext *parentNew)
httpSessionMove(HttpSession *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -48,7 +48,7 @@ IoWrite *httpSessionIoWrite(HttpSession *this);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
httpSessionFree(HttpSession *this)
httpSessionFree(HttpSession *const this)
{
objFree(this);
}

View File

@ -54,35 +54,35 @@ typedef struct HttpUrlPub
// Protocol type
__attribute__((always_inline)) static inline HttpProtocolType
httpUrlProtocolType(const HttpUrl *this)
httpUrlProtocolType(const HttpUrl *const this)
{
return THIS_PUB(HttpUrl)->type;
}
// Host
__attribute__((always_inline)) static inline const String *
httpUrlHost(const HttpUrl *this)
httpUrlHost(const HttpUrl *const this)
{
return THIS_PUB(HttpUrl)->host;
}
// Path
__attribute__((always_inline)) static inline const String *
httpUrlPath(const HttpUrl *this)
httpUrlPath(const HttpUrl *const this)
{
return THIS_PUB(HttpUrl)->path;
}
// Port
__attribute__((always_inline)) static inline unsigned int
httpUrlPort(const HttpUrl *this)
httpUrlPort(const HttpUrl *const this)
{
return THIS_PUB(HttpUrl)->port;
}
// URL (exactly as originally passed)
__attribute__((always_inline)) static inline const String *
httpUrl(const HttpUrl *this)
httpUrl(const HttpUrl *const this)
{
return THIS_PUB(HttpUrl)->url;
}
@ -91,7 +91,7 @@ httpUrl(const HttpUrl *this)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
httpUrlFree(HttpUrl *this)
httpUrlFree(HttpUrl *const this)
{
objFree(this);
}

View File

@ -89,7 +89,7 @@ void ioReadClose(IoRead *this);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
ioReadFree(IoRead *this)
ioReadFree(IoRead *const this)
{
objFree(this);
}

View File

@ -58,7 +58,7 @@ ioReadDriver(IoRead *const this)
// Interface for the read object
__attribute__((always_inline)) static inline const IoReadInterface *
ioReadInterface(const IoRead *this)
ioReadInterface(const IoRead *const this)
{
return &THIS_PUB(IoRead)->interface;
}

View File

@ -72,7 +72,7 @@ ioSessionClose(IoSession *const this)
// Move to a new parent mem context
__attribute__((always_inline)) static inline IoSession *
ioSessionMove(IoSession *this, MemContext *parentNew)
ioSessionMove(IoSession *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -81,7 +81,7 @@ ioSessionMove(IoSession *this, MemContext *parentNew)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
ioSessionFree(IoSession *this)
ioSessionFree(IoSession *const this)
{
objFree(this);
}

View File

@ -77,7 +77,7 @@ void ioWriteClose(IoWrite *this);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
ioWriteFree(IoWrite *this)
ioWriteFree(IoWrite *const this)
{
objFree(this);
}

View File

@ -50,7 +50,7 @@ String *regExpPrefix(const String *expression);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
regExpFree(RegExp *this)
regExpFree(RegExp *const this)
{
objFree(this);
}

View File

@ -68,7 +68,7 @@ String *bufHex(const Buffer *this);
// Move to a new parent mem context
__attribute__((always_inline)) static inline Buffer *
bufMove(Buffer *this, MemContext *parentNew)
bufMove(Buffer *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -82,7 +82,7 @@ void bufLimitSet(Buffer *this, size_t limit);
// Buffer size
__attribute__((always_inline)) static inline size_t
bufSize(const Buffer *this)
bufSize(const Buffer *const this)
{
ASSERT_INLINE(this != NULL);
return ((const BufferConst *)this)->size;
@ -90,7 +90,7 @@ bufSize(const Buffer *this)
// Allocated buffer size. This may be different from bufSize() if a limit has been set.
__attribute__((always_inline)) static inline size_t
bufSizeAlloc(const Buffer *this)
bufSizeAlloc(const Buffer *const this)
{
ASSERT_INLINE(this != NULL);
return ((const BufferConst *)this)->sizeAlloc;
@ -99,7 +99,7 @@ bufSizeAlloc(const Buffer *this)
// Amount of the buffer actually used. This will be updated automatically when possible but if the buffer is modified by using
// bufPtr() then the user is responsible for updating used.
__attribute__((always_inline)) static inline size_t
bufUsed(const Buffer *this)
bufUsed(const Buffer *const this)
{
ASSERT_INLINE(this != NULL);
return ((const BufferConst *)this)->used;
@ -111,21 +111,21 @@ void bufUsedZero(Buffer *this);
// Is the buffer empty?
__attribute__((always_inline)) static inline bool
bufEmpty(const Buffer *this)
bufEmpty(const Buffer *const this)
{
return bufUsed(this) == 0;
}
// Remaining space in the buffer
__attribute__((always_inline)) static inline size_t
bufRemains(const Buffer *this)
bufRemains(const Buffer *const this)
{
return bufSize(this) - bufUsed(this);
}
// Is the buffer full?
__attribute__((always_inline)) static inline bool
bufFull(const Buffer *this)
bufFull(const Buffer *const this)
{
return bufUsed(this) == bufSize(this);
}
@ -135,7 +135,7 @@ Getters/Setters
***********************************************************************************************************************************/
// Buffer pointer
__attribute__((always_inline)) static inline unsigned char *
bufPtr(Buffer *this)
bufPtr(Buffer *const this)
{
ASSERT_INLINE(this != NULL);
return (void *)((BufferConst *)this)->buffer;
@ -143,7 +143,7 @@ bufPtr(Buffer *this)
// Const buffer pointer
__attribute__((always_inline)) static inline const unsigned char *
bufPtrConst(const Buffer *this)
bufPtrConst(const Buffer *const this)
{
ASSERT_INLINE(this != NULL);
return ((const BufferConst *)this)->buffer;
@ -151,7 +151,7 @@ bufPtrConst(const Buffer *this)
// Pointer to remaining buffer space (after used space)
__attribute__((always_inline)) static inline unsigned char *
bufRemainsPtr(Buffer *this)
bufRemainsPtr(Buffer *const this)
{
return bufPtr(this) + bufUsed(this);
}
@ -160,7 +160,7 @@ bufRemainsPtr(Buffer *this)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
bufFree(Buffer *this)
bufFree(Buffer *const this)
{
objFree(this);
}

View File

@ -41,25 +41,25 @@ int64_t cvtZToInt64Base(const char *value, int base);
// bits as possible into the low order bits which is good for other types of encoding, e.g. base-128. See
// http://neurocline.github.io/dev/2015/09/17/zig-zag-encoding.html for details.
__attribute__((always_inline)) static inline uint32_t
cvtInt32ToZigZag(int32_t value)
cvtInt32ToZigZag(const int32_t value)
{
return ((uint32_t)value << 1) ^ (uint32_t)(value >> 31);
}
__attribute__((always_inline)) static inline int32_t
cvtInt32FromZigZag(uint32_t value)
cvtInt32FromZigZag(const uint32_t value)
{
return (int32_t)((value >> 1) ^ (~(value & 1) + 1));
}
__attribute__((always_inline)) static inline uint64_t
cvtInt64ToZigZag(int64_t value)
cvtInt64ToZigZag(const int64_t value)
{
return ((uint64_t)value << 1) ^ (uint64_t)(value >> 63);
}
__attribute__((always_inline)) static inline int64_t
cvtInt64FromZigZag(uint64_t value)
cvtInt64FromZigZag(const uint64_t value)
{
return (int64_t)((value >> 1) ^ (~(value & 1) + 1));
}

View File

@ -47,7 +47,7 @@ KeyValue *kvAdd(KeyValue *this, const Variant *key, const Variant *value);
// Move to a new parent mem context
__attribute__((always_inline)) static inline KeyValue *
kvMove(KeyValue *this, MemContext *parentNew)
kvMove(KeyValue *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -82,7 +82,7 @@ VariantList *kvGetList(const KeyValue *this, const Variant *key);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
kvFree(KeyValue *this)
kvFree(KeyValue *const this)
{
objFree(this);
}

View File

@ -75,21 +75,21 @@ List *lstComparatorSet(List *this, ListComparator *comparator);
// Memory context for this list
__attribute__((always_inline)) static inline MemContext *
lstMemContext(const List *this)
lstMemContext(const List *const this)
{
return THIS_PUB(List)->memContext;
}
// List size
__attribute__((always_inline)) static inline unsigned int
lstSize(const List *this)
lstSize(const List *const this)
{
return THIS_PUB(List)->listSize;
}
// Is the list empty?
__attribute__((always_inline)) static inline bool
lstEmpty(const List *this)
lstEmpty(const List *const this)
{
return lstSize(this) == 0;
}
@ -111,7 +111,7 @@ unsigned int lstFindIdx(const List *this, const void *item);
// Does an item exist in the list?
__attribute__((always_inline)) static inline bool
lstExists(const List *this, const void *item)
lstExists(const List *const this, const void *const item)
{
return lstFind(this, item) != NULL;
}
@ -124,14 +124,14 @@ void *lstInsert(List *this, unsigned int listIdx, const void *item);
// Add an item to the end of the list
__attribute__((always_inline)) static inline void *
lstAdd(List *this, const void *item)
lstAdd(List *const this, const void *const item)
{
return lstInsert(this, lstSize(this), item);
}
// Move to a new parent mem context
__attribute__((always_inline)) static inline List *
lstMove(List *this, MemContext *parentNew)
lstMove(List *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -148,7 +148,7 @@ List *lstSort(List *this, SortOrder sortOrder);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
lstFree(List *this)
lstFree(List *const this)
{
objFree(this);
}

View File

@ -36,7 +36,7 @@ const Variant *mcvResult(const MostCommonValue *this);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
mcvFree(MostCommonValue *this)
mcvFree(MostCommonValue *const this)
{
objFree(this);
}

View File

@ -298,7 +298,7 @@ void pckReadEnd(PackRead *this);
Read Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
pckReadFree(PackRead *this)
pckReadFree(PackRead *const this)
{
objFree(this);
}
@ -473,7 +473,7 @@ PackWrite *pckWriteEnd(PackWrite *this);
Write Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
pckWriteFree(PackWrite *this)
pckWriteFree(PackWrite *const this)
{
objFree(this);
}

View File

@ -148,7 +148,7 @@ String *strPathAbsolute(const String *this, const String *base);
// Pointer to zero-terminated string. strZNull() returns NULL when the String is NULL.
__attribute__((always_inline)) static inline const char *
strZ(const String *this)
strZ(const String *const this)
{
ASSERT_INLINE(this != NULL);
return ((const StringConst *)this)->buffer;
@ -165,7 +165,7 @@ String *strReplaceChr(String *this, char find, char replace);
// String size minus null-terminator, i.e. the same value that strlen() would return
__attribute__((always_inline)) static inline size_t
strSize(const String *this)
strSize(const String *const this)
{
ASSERT_INLINE(this != NULL);
return ((const StringConst *)this)->size;

View File

@ -16,7 +16,7 @@ String List Handler
Internal add -- the string must have been created in the list's mem context before being passed
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline String *
strLstAddInternal(StringList *this, String *string)
strLstAddInternal(StringList *const this, String *const string)
{
return *(String **)lstAdd((List *)this, &string);
}
@ -25,7 +25,7 @@ strLstAddInternal(StringList *this, String *string)
Internal insert -- the string must have been created in the list's mem context before being passed
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline String *
strLstInsertInternal(StringList *this, unsigned int listIdx, String *string)
strLstInsertInternal(StringList *const this, const unsigned int listIdx, String *const string)
{
return *(String **)lstInsert((List *)this, listIdx, &string);
}

View File

@ -28,7 +28,7 @@ strLstNew(void)
StringList *strLstNewSplitZ(const String *string, const char *delimiter);
__attribute__((always_inline)) static inline StringList *
strLstNewSplit(const String *string, const String *delimiter)
strLstNewSplit(const String *const string, const String *const delimiter)
{
return strLstNewSplitZ(string, strZ(delimiter));
}
@ -44,21 +44,21 @@ Getters/Setters
***********************************************************************************************************************************/
// Set a new comparator
__attribute__((always_inline)) static inline StringList *
strLstComparatorSet(StringList *this, ListComparator *comparator)
strLstComparatorSet(StringList *const this, ListComparator *const comparator)
{
return (StringList *)lstComparatorSet((List *)this, comparator);
}
// List size
__attribute__((always_inline)) static inline unsigned int
strLstSize(const StringList *this)
strLstSize(const StringList *const this)
{
return lstSize((List *)this);
}
// Is the list empty?
__attribute__((always_inline)) static inline bool
strLstEmpty(const StringList *this)
strLstEmpty(const StringList *const this)
{
return strLstSize(this) == 0;
}
@ -73,7 +73,7 @@ String *strLstAddIfMissing(StringList *this, const String *string);
// Does the specified string exist in the list?
__attribute__((always_inline)) static inline bool
strLstExists(const StringList *this, const String *string)
strLstExists(const StringList *const this, const String *const string)
{
return lstExists((List *)this, &string);
}
@ -83,7 +83,7 @@ String *strLstInsert(StringList *this, unsigned int listIdx, const String *strin
// Get a string by index
__attribute__((always_inline)) static inline String *
strLstGet(const StringList *this, unsigned int listIdx)
strLstGet(const StringList *const this, const unsigned int listIdx)
{
return *(String **)lstGet((List *)this, listIdx);
}
@ -93,7 +93,7 @@ String *strLstJoinQuote(const StringList *this, const char *separator, const cha
// Join a list of strings into a single string using the specified separator
__attribute__((always_inline)) static inline String *
strLstJoin(const StringList *this, const char *separator)
strLstJoin(const StringList *const this, const char *const separator)
{
return strLstJoinQuote(this, separator, "");
}
@ -104,7 +104,7 @@ StringList *strLstMergeAnti(const StringList *this, const StringList *anti);
// Move to a new parent mem context
__attribute__((always_inline)) static inline StringList *
strLstMove(StringList *this, MemContext *parentNew)
strLstMove(StringList *const this, MemContext *const parentNew)
{
return (StringList *)lstMove((List *)this, parentNew);
}
@ -115,20 +115,20 @@ const char **strLstPtr(const StringList *this);
// Remove an item from the list
__attribute__((always_inline)) static inline bool
strLstRemove(StringList *this, const String *item)
strLstRemove(StringList *const this, const String *const item)
{
return lstRemove((List *)this, &item);
}
__attribute__((always_inline)) static inline StringList *
strLstRemoveIdx(StringList *this, unsigned int listIdx)
strLstRemoveIdx(StringList *const this, const unsigned int listIdx)
{
return (StringList *)lstRemoveIdx((List *)this, listIdx);
}
// List sort
__attribute__((always_inline)) static inline StringList *
strLstSort(StringList *this, SortOrder sortOrder)
strLstSort(StringList *const this, const SortOrder sortOrder)
{
return (StringList *)lstSort((List *)this, sortOrder);
}
@ -137,7 +137,7 @@ strLstSort(StringList *this, SortOrder sortOrder)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
strLstFree(StringList *this)
strLstFree(StringList *const this)
{
lstFree((List *)this);
}

View File

@ -33,14 +33,14 @@ Getters/Setters
***********************************************************************************************************************************/
// List size
__attribute__((always_inline)) static inline unsigned int
varLstSize(const VariantList *this)
varLstSize(const VariantList *const this)
{
return lstSize((List *)this);
}
// Is the list empty?
__attribute__((always_inline)) static inline bool
varLstEmpty(const VariantList *this)
varLstEmpty(const VariantList *const this)
{
return varLstSize(this) == 0;
}
@ -50,7 +50,7 @@ Functions
***********************************************************************************************************************************/
// Add to list
__attribute__((always_inline)) static inline VariantList *
varLstAdd(VariantList *this, Variant *data)
varLstAdd(VariantList *const this, Variant *const data)
{
lstAdd((List *)this, &data);
return this;
@ -58,14 +58,14 @@ varLstAdd(VariantList *this, Variant *data)
// Get by index
__attribute__((always_inline)) static inline Variant *
varLstGet(const VariantList *this, const unsigned int listIdx)
varLstGet(const VariantList *const this, const unsigned int listIdx)
{
return *(Variant **)lstGet((List *)this, listIdx);
}
// Move to new parent mem context
__attribute__((always_inline)) static inline VariantList *
varLstMove(VariantList *this, MemContext *parentNew)
varLstMove(VariantList *const this, MemContext *const parentNew)
{
return (VariantList *)lstMove((List *)this, parentNew);
}
@ -74,7 +74,7 @@ varLstMove(VariantList *this, MemContext *parentNew)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
varLstFree(VariantList *this)
varLstFree(VariantList *const this)
{
lstFree((List *)this);
}

View File

@ -52,7 +52,7 @@ xmlDocumentRoot(const XmlDocument *const this)
Document Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
xmlDocumentFree(XmlDocument *this)
xmlDocumentFree(XmlDocument *const this)
{
objFree(this);
}

View File

@ -28,7 +28,7 @@ typedef struct WaitPub
// How much time is remaining? Recalculated each time waitMore() is called.
__attribute__((always_inline)) static inline TimeMSec
waitRemaining(const Wait *this)
waitRemaining(const Wait *const this)
{
return THIS_PUB(Wait)->remainTime;
}
@ -43,7 +43,7 @@ bool waitMore(Wait *this);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
waitFree(Wait *this)
waitFree(Wait *const this)
{
objFree(this);
}

View File

@ -395,7 +395,7 @@ Find an option by name in the option list
***********************************************************************************************************************************/
// Helper to parse the option info into a structure
__attribute__((always_inline)) static inline CfgParseOptionResult
cfgParseOptionInfo(int info)
cfgParseOptionInfo(const int info)
{
return (CfgParseOptionResult)
{

View File

@ -108,7 +108,7 @@ void dbClose(Db *this);
// Move to a new parent mem context
__attribute__((always_inline)) static inline Db *
dbMove(Db *this, MemContext *parentNew)
dbMove(Db *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -117,7 +117,7 @@ dbMove(Db *this, MemContext *parentNew)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
dbFree(Db *this)
dbFree(Db *const this)
{
objFree(this);
}

View File

@ -75,7 +75,7 @@ const String *infoArchiveIdHistoryMatch(
// Move to a new parent mem context
__attribute__((always_inline)) static inline InfoArchive *
infoArchiveMove(InfoArchive *this, MemContext *parentNew)
infoArchiveMove(InfoArchive *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -84,7 +84,7 @@ infoArchiveMove(InfoArchive *this, MemContext *parentNew)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
infoArchiveFree(InfoArchive *this)
infoArchiveFree(InfoArchive *const this)
{
objFree(this);
}

View File

@ -124,7 +124,7 @@ StringList *infoBackupDataLabelList(const InfoBackup *this, const String *expres
// Move to a new parent mem context
__attribute__((always_inline)) static inline InfoBackup *
infoBackupMove(InfoBackup *this, MemContext *parentNew)
infoBackupMove(InfoBackup *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -133,7 +133,7 @@ infoBackupMove(InfoBackup *this, MemContext *parentNew)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
infoBackupFree(InfoBackup *this)
infoBackupFree(InfoBackup *const this)
{
objFree(this);
}

View File

@ -220,7 +220,7 @@ void manifestLinkCheck(const Manifest *this);
// Move to a new parent mem context
__attribute__((always_inline)) static inline Manifest *
manifestMove(Manifest *this, MemContext *parentNew)
manifestMove(Manifest *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -381,7 +381,7 @@ void manifestTargetUpdate(const Manifest *this, const String *name, const String
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
manifestFree(Manifest *this)
manifestFree(Manifest *const this)
{
objFree(this);
}

View File

@ -32,7 +32,7 @@ PgClient *pgClientOpen(PgClient *this);
// Move to a new parent mem context
__attribute__((always_inline)) static inline PgClient *
pgClientMove(PgClient *this, MemContext *parentNew)
pgClientMove(PgClient *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -47,7 +47,7 @@ void pgClientClose(PgClient *this);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
pgClientFree(PgClient *this)
pgClientFree(PgClient *const this)
{
objFree(this);
}

View File

@ -52,14 +52,14 @@ typedef struct ProtocolClientPub
// Read interface
__attribute__((always_inline)) static inline IoRead *
protocolClientIoRead(ProtocolClient *this)
protocolClientIoRead(ProtocolClient *const this)
{
return THIS_PUB(ProtocolClient)->read;
}
// Write interface
__attribute__((always_inline)) static inline IoWrite *
protocolClientIoWrite(ProtocolClient *this)
protocolClientIoWrite(ProtocolClient *const this)
{
return THIS_PUB(ProtocolClient)->write;
}
@ -72,7 +72,7 @@ const Variant *protocolClientExecute(ProtocolClient *this, const ProtocolCommand
// Move to a new parent mem context
__attribute__((always_inline)) static inline ProtocolClient *
protocolClientMove(ProtocolClient *this, MemContext *parentNew)
protocolClientMove(ProtocolClient *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -93,7 +93,7 @@ void protocolClientWriteCommand(ProtocolClient *this, const ProtocolCommand *com
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
protocolClientFree(ProtocolClient *this)
protocolClientFree(ProtocolClient *const this)
{
objFree(this);
}

View File

@ -38,7 +38,7 @@ Functions
// Move to a new parent mem context
// Move to a new parent mem context
__attribute__((always_inline)) static inline ProtocolCommand *
protocolCommandMove(ProtocolCommand *this, MemContext *parentNew)
protocolCommandMove(ProtocolCommand *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -50,7 +50,7 @@ ProtocolCommand *protocolCommandParamAdd(ProtocolCommand *this, const Variant *p
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
protocolCommandFree(ProtocolCommand *this)
protocolCommandFree(ProtocolCommand *const this)
{
objFree(this);
}

View File

@ -49,7 +49,7 @@ unsigned int protocolParallelProcess(ProtocolParallel *this);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
protocolParallelFree(ProtocolParallel *this)
protocolParallelFree(ProtocolParallel *const this)
{
objFree(this);
}

View File

@ -45,20 +45,20 @@ typedef struct ProtocolParallelJobPub
// Job command
__attribute__((always_inline)) static inline const ProtocolCommand *
protocolParallelJobCommand(const ProtocolParallelJob *this)
protocolParallelJobCommand(const ProtocolParallelJob *const this)
{
return THIS_PUB(ProtocolParallelJob)->command;
}
// Job error
__attribute__((always_inline)) static inline int
protocolParallelJobErrorCode(const ProtocolParallelJob *this)
protocolParallelJobErrorCode(const ProtocolParallelJob *const this)
{
return THIS_PUB(ProtocolParallelJob)->code;
}
__attribute__((always_inline)) static inline const String *
protocolParallelJobErrorMessage(const ProtocolParallelJob *this)
protocolParallelJobErrorMessage(const ProtocolParallelJob *const this)
{
return THIS_PUB(ProtocolParallelJob)->message;
}
@ -67,14 +67,14 @@ void protocolParallelJobErrorSet(ProtocolParallelJob *this, int code, const Stri
// Job key
__attribute__((always_inline)) static inline const Variant *
protocolParallelJobKey(const ProtocolParallelJob *this)
protocolParallelJobKey(const ProtocolParallelJob *const this)
{
return THIS_PUB(ProtocolParallelJob)->key;
}
// Process Id
__attribute__((always_inline)) static inline unsigned int
protocolParallelJobProcessId(const ProtocolParallelJob *this)
protocolParallelJobProcessId(const ProtocolParallelJob *const this)
{
return THIS_PUB(ProtocolParallelJob)->processId;
}
@ -83,7 +83,7 @@ void protocolParallelJobProcessIdSet(ProtocolParallelJob *this, unsigned int pro
// Job result
__attribute__((always_inline)) static inline const Variant *
protocolParallelJobResult(const ProtocolParallelJob *this)
protocolParallelJobResult(const ProtocolParallelJob *const this)
{
return THIS_PUB(ProtocolParallelJob)->result;
}
@ -92,7 +92,7 @@ void protocolParallelJobResultSet(ProtocolParallelJob *this, const Variant *resu
// Job state
__attribute__((always_inline)) static inline ProtocolParallelJobState
protocolParallelJobState(const ProtocolParallelJob *this)
protocolParallelJobState(const ProtocolParallelJob *const this)
{
return THIS_PUB(ProtocolParallelJob)->state;
}
@ -104,7 +104,7 @@ Functions
***********************************************************************************************************************************/
// Move to new parent mem context
__attribute__((always_inline)) static inline ProtocolParallelJob *
protocolParallelJobMove(ProtocolParallelJob *this, MemContext *parentNew)
protocolParallelJobMove(ProtocolParallelJob *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -113,7 +113,7 @@ protocolParallelJobMove(ProtocolParallelJob *this, MemContext *parentNew)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
protocolParallelJobFree(ProtocolParallelJob *this)
protocolParallelJobFree(ProtocolParallelJob *const this)
{
objFree(this);
}

View File

@ -47,14 +47,14 @@ typedef struct ProtocolServerPub
// Read interface
__attribute__((always_inline)) static inline IoRead *
protocolServerIoRead(ProtocolServer *this)
protocolServerIoRead(ProtocolServer *const this)
{
return THIS_PUB(ProtocolServer)->read;
}
// Write interface
__attribute__((always_inline)) static inline IoWrite *
protocolServerIoWrite(ProtocolServer *this)
protocolServerIoWrite(ProtocolServer *const this)
{
return THIS_PUB(ProtocolServer)->write;
}
@ -75,7 +75,7 @@ void protocolServerResponse(ProtocolServer *this, const Variant *output);
// Move to a new parent mem context
__attribute__((always_inline)) static inline ProtocolServer *
protocolServerMove(ProtocolServer *this, MemContext *parentNew)
protocolServerMove(ProtocolServer *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -87,7 +87,7 @@ void protocolServerWriteLine(ProtocolServer *this, const String *line);
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
protocolServerFree(ProtocolServer *this)
protocolServerFree(ProtocolServer *const this)
{
objFree(this);
}

View File

@ -17,7 +17,7 @@ typedef struct StorageRead StorageRead;
Functions
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline StorageRead *
storageReadMove(StorageRead *this, MemContext *parentNew)
storageReadMove(StorageRead *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -34,35 +34,35 @@ typedef struct StorageReadPub
// Should a missing file be ignored?
__attribute__((always_inline)) static inline bool
storageReadIgnoreMissing(const StorageRead *this)
storageReadIgnoreMissing(const StorageRead *const this)
{
return THIS_PUB(StorageRead)->interface->ignoreMissing;
}
// Read interface
__attribute__((always_inline)) static inline IoRead *
storageReadIo(const StorageRead *this)
storageReadIo(const StorageRead *const this)
{
return THIS_PUB(StorageRead)->io;
}
// Is there a read limit? NULL for no limit.
__attribute__((always_inline)) static inline const Variant *
storageReadLimit(const StorageRead *this)
storageReadLimit(const StorageRead *const this)
{
return THIS_PUB(StorageRead)->interface->limit;
}
// File name
__attribute__((always_inline)) static inline const String *
storageReadName(const StorageRead *this)
storageReadName(const StorageRead *const this)
{
return THIS_PUB(StorageRead)->interface->name;
}
// Get file type
__attribute__((always_inline)) static inline const String *
storageReadType(const StorageRead *this)
storageReadType(const StorageRead *const this)
{
return THIS_PUB(StorageRead)->interface->type;
}
@ -71,7 +71,7 @@ storageReadType(const StorageRead *this)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
storageReadFree(StorageRead *this)
storageReadFree(StorageRead *const this)
{
objFree(this);
}

View File

@ -251,14 +251,14 @@ Getters/Setters
***********************************************************************************************************************************/
// Is the feature supported by this storage?
__attribute__((always_inline)) static inline bool
storageFeature(const Storage *this, StorageFeature feature)
storageFeature(const Storage *const this, const StorageFeature feature)
{
return THIS_PUB(Storage)->interface.feature >> feature & 1;
}
// Storage type (posix, cifs, etc.)
__attribute__((always_inline)) static inline const String *
storageType(const Storage *this)
storageType(const Storage *const this)
{
return THIS_PUB(Storage)->type;
}

View File

@ -291,14 +291,14 @@ typedef struct StoragePub
// Storage driver
__attribute__((always_inline)) static inline void *
storageDriver(const Storage *this)
storageDriver(const Storage *const this)
{
return THIS_PUB(Storage)->driver;
}
// Storage interface
__attribute__((always_inline)) static inline StorageInterface
storageInterface(const Storage *this)
storageInterface(const Storage *const this)
{
return THIS_PUB(Storage)->interface;
}

View File

@ -20,7 +20,7 @@ Functions
***********************************************************************************************************************************/
// Move to a new parent mem context
__attribute__((always_inline)) static inline StorageWrite *
storageWriteMove(StorageWrite *this, MemContext *parentNew)
storageWriteMove(StorageWrite *const this, MemContext *const parentNew)
{
return objMove(this, parentNew);
}
@ -38,63 +38,63 @@ typedef struct StorageWritePub
// Will the file be written atomically? Atomic writes means the file will be complete or be missing. Filesystems have different ways
// to accomplish this.
__attribute__((always_inline)) static inline bool
storageWriteAtomic(const StorageWrite *this)
storageWriteAtomic(const StorageWrite *const this)
{
return THIS_PUB(StorageWrite)->interface->atomic;
}
// Will the path be created if required?
__attribute__((always_inline)) static inline bool
storageWriteCreatePath(const StorageWrite *this)
storageWriteCreatePath(const StorageWrite *const this)
{
return THIS_PUB(StorageWrite)->interface->createPath;
}
// Write interface
__attribute__((always_inline)) static inline IoWrite *
storageWriteIo(const StorageWrite *this)
storageWriteIo(const StorageWrite *const this)
{
return THIS_PUB(StorageWrite)->io;
}
// File mode
__attribute__((always_inline)) static inline mode_t
storageWriteModeFile(const StorageWrite *this)
storageWriteModeFile(const StorageWrite *const this)
{
return THIS_PUB(StorageWrite)->interface->modeFile;
}
// Path mode (if the destination path needs to be create)
__attribute__((always_inline)) static inline mode_t
storageWriteModePath(const StorageWrite *this)
storageWriteModePath(const StorageWrite *const this)
{
return THIS_PUB(StorageWrite)->interface->modePath;
}
// File name
__attribute__((always_inline)) static inline const String *
storageWriteName(const StorageWrite *this)
storageWriteName(const StorageWrite *const this)
{
return THIS_PUB(StorageWrite)->interface->name;
}
// Will the file be synced before it is closed?
__attribute__((always_inline)) static inline bool
storageWriteSyncFile(const StorageWrite *this)
storageWriteSyncFile(const StorageWrite *const this)
{
return THIS_PUB(StorageWrite)->interface->syncFile;
}
// Will the path be synced after the file is closed?
__attribute__((always_inline)) static inline bool
storageWriteSyncPath(const StorageWrite *this)
storageWriteSyncPath(const StorageWrite *const this)
{
return THIS_PUB(StorageWrite)->interface->syncPath;
}
// File type
__attribute__((always_inline)) static inline const String *
storageWriteType(const StorageWrite *this)
storageWriteType(const StorageWrite *const this)
{
return THIS_PUB(StorageWrite)->interface->type;
}
@ -103,7 +103,7 @@ storageWriteType(const StorageWrite *this)
Destructor
***********************************************************************************************************************************/
__attribute__((always_inline)) static inline void
storageWriteFree(StorageWrite *this)
storageWriteFree(StorageWrite *const this)
{
objFree(this);
}

View File

@ -198,7 +198,7 @@ hrnCfgArgKeyRawReset(StringList *argList, ConfigOption optionId, unsigned option
/**********************************************************************************************************************************/
__attribute__((always_inline)) static inline const char *
hrnCfgEnvName(ConfigOption optionId, unsigned optionKey)
hrnCfgEnvName(const ConfigOption optionId, const unsigned optionKey)
{
return strZ(
strReplaceChr(strUpper(strNewFmt(HRN_PGBACKREST_ENV "%s", cfgParseOptionKeyIdxName(optionId, optionKey - 1))), '-', '_'));