mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-06-02 22:57:34 +02:00
Add THIS_PUB() macro to simplify inline object accessors.
In combination with the thisPub() function, this macro simplifies accessing the public part of a private object struct. thisPub() asserts this != NULL so the caller does not need to do it.
This commit is contained in:
parent
9fec4ce98c
commit
a0e24d492f
@ -219,12 +219,13 @@ typedef struct ListPub
|
|||||||
|
|
||||||
// List size
|
// List size
|
||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
lstSize(const List *this)
|
lstSize(const List *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(List)->listSize;
|
||||||
return ((const ListPub *)this)->listSize;
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
`THIS_PUB()` ensures that `this != NULL` so there is no need to check that in the calling function.
|
||||||
|
|
||||||
And the C file:
|
And the C file:
|
||||||
```c
|
```c
|
||||||
struct List
|
struct List
|
||||||
|
@ -282,13 +282,14 @@ typedef struct ListPub
|
|||||||
|
|
||||||
// List size
|
// List size
|
||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
lstSize(const List *this)
|
lstSize(const List *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(List)->listSize;
|
||||||
return ((const ListPub *)this)->listSize;
|
|
||||||
}
|
}
|
||||||
</code-block>
|
</code-block>
|
||||||
|
|
||||||
|
<p><code>THIS_PUB()</code> ensures that <code>this != NULL</code> so there is no need to check that in the calling function.</p>
|
||||||
|
|
||||||
<p>And the C file:</p>
|
<p>And the C file:</p>
|
||||||
|
|
||||||
<code-block type="c">
|
<code-block type="c">
|
||||||
|
@ -38,24 +38,21 @@ typedef struct DbPub
|
|||||||
__attribute__((always_inline)) static inline IoRead *
|
__attribute__((always_inline)) static inline IoRead *
|
||||||
execIoRead(Exec *const this)
|
execIoRead(Exec *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Exec)->ioReadExec;
|
||||||
return ((ExecPub *)this)->ioReadExec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write interface
|
// Write interface
|
||||||
__attribute__((always_inline)) static inline IoWrite *
|
__attribute__((always_inline)) static inline IoWrite *
|
||||||
execIoWrite(Exec *const this)
|
execIoWrite(Exec *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Exec)->ioWriteExec;
|
||||||
return ((ExecPub *)this)->ioWriteExec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exec MemContext
|
// Exec MemContext
|
||||||
__attribute__((always_inline)) static inline MemContext *
|
__attribute__((always_inline)) static inline MemContext *
|
||||||
execMemContext(Exec *const this)
|
execMemContext(Exec *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Exec)->memContext;
|
||||||
return ((ExecPub *)this)->memContext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -30,8 +30,7 @@ typedef struct IoClientPub
|
|||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
ioClientName(const IoClient *const this)
|
ioClientName(const IoClient *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoClient)->interface->name(THIS_PUB(IoClient)->driver);
|
||||||
return ((const IoClientPub *)this)->interface->name(((const IoClientPub *)this)->driver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@ -48,8 +47,7 @@ ioClientMove(IoClient *this, MemContext *parentNew)
|
|||||||
__attribute__((always_inline)) static inline IoSession *
|
__attribute__((always_inline)) static inline IoSession *
|
||||||
ioClientOpen(IoClient *const this)
|
ioClientOpen(IoClient *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoClient)->interface->open(THIS_PUB(IoClient)->driver);
|
||||||
return ((const IoClientPub *)this)->interface->open(((const IoClientPub *)this)->driver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -31,8 +31,7 @@ Variant *ioFilterResult(const IoFilter *this);
|
|||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
ioFilterType(const IoFilter *const this)
|
ioFilterType(const IoFilter *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoFilter)->type;
|
||||||
return ((IoFilterPub *)this)->type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -72,8 +72,7 @@ bool ioFilterDone(const IoFilter *this);
|
|||||||
__attribute__((always_inline)) static inline void *
|
__attribute__((always_inline)) static inline void *
|
||||||
ioFilterDriver(IoFilter *const this)
|
ioFilterDriver(IoFilter *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoFilter)->driver;
|
||||||
return ((IoFilterPub *)this)->driver;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does the filter need the same input again? If the filter cannot get all its output into the output buffer then it may need access
|
// Does the filter need the same input again? If the filter cannot get all its output into the output buffer then it may need access
|
||||||
@ -84,24 +83,21 @@ bool ioFilterInputSame(const IoFilter *this);
|
|||||||
__attribute__((always_inline)) static inline const IoFilterInterface *
|
__attribute__((always_inline)) static inline const IoFilterInterface *
|
||||||
ioFilterInterface(const IoFilter *const this)
|
ioFilterInterface(const IoFilter *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return &THIS_PUB(IoFilter)->interface;
|
||||||
return &((IoFilterPub *)this)->interface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does filter produce output? All In filters produce output.
|
// Does filter produce output? All In filters produce output.
|
||||||
__attribute__((always_inline)) static inline bool
|
__attribute__((always_inline)) static inline bool
|
||||||
ioFilterOutput(const IoFilter *const this)
|
ioFilterOutput(const IoFilter *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoFilter)->interface.inOut != NULL;
|
||||||
return ((IoFilterPub *)this)->interface.inOut != NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of filter parameters
|
// List of filter parameters
|
||||||
__attribute__((always_inline)) static inline const VariantList *
|
__attribute__((always_inline)) static inline const VariantList *
|
||||||
ioFilterParamList(const IoFilter *const this)
|
ioFilterParamList(const IoFilter *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoFilter)->paramList;
|
||||||
return ((IoFilterPub *)this)->paramList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -44,9 +44,8 @@ typedef struct IoFilterGroupPub
|
|||||||
__attribute__((always_inline)) static inline bool
|
__attribute__((always_inline)) static inline bool
|
||||||
ioFilterGroupDone(const IoFilterGroup *const this)
|
ioFilterGroupDone(const IoFilterGroup *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
ASSERT_INLINE(THIS_PUB(IoFilterGroup)->opened && !THIS_PUB(IoFilterGroup)->closed);
|
||||||
ASSERT_INLINE(((IoFilterGroupPub *)this)->opened && !((IoFilterGroupPub *)this)->closed);
|
return THIS_PUB(IoFilterGroup)->done;
|
||||||
return ((IoFilterGroupPub *)this)->done;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should the same input be passed again? A buffer of input can produce multiple buffers of output, e.g. when a file containing all
|
// Should the same input be passed again? A buffer of input can produce multiple buffers of output, e.g. when a file containing all
|
||||||
@ -54,9 +53,8 @@ ioFilterGroupDone(const IoFilterGroup *const this)
|
|||||||
__attribute__((always_inline)) static inline bool
|
__attribute__((always_inline)) static inline bool
|
||||||
ioFilterGroupInputSame(const IoFilterGroup *const this)
|
ioFilterGroupInputSame(const IoFilterGroup *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
ASSERT_INLINE(THIS_PUB(IoFilterGroup)->opened && !THIS_PUB(IoFilterGroup)->closed);
|
||||||
ASSERT_INLINE(((IoFilterGroupPub *)this)->opened && !((IoFilterGroupPub *)this)->closed);
|
return THIS_PUB(IoFilterGroup)->inputSame;
|
||||||
return ((IoFilterGroupPub *)this)->inputSame;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all filters and their parameters so they can be passed to a remote
|
// Get all filters and their parameters so they can be passed to a remote
|
||||||
@ -73,8 +71,7 @@ void ioFilterGroupResultAllSet(IoFilterGroup *this, const Variant *filterResult)
|
|||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
ioFilterGroupSize(const IoFilterGroup *const this)
|
ioFilterGroupSize(const IoFilterGroup *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return lstSize(THIS_PUB(IoFilterGroup)->filterList);
|
||||||
return lstSize(((IoFilterGroupPub *)this)->filterList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -55,8 +55,7 @@ typedef struct HttpClientPub
|
|||||||
__attribute__((always_inline)) static inline TimeMSec
|
__attribute__((always_inline)) static inline TimeMSec
|
||||||
httpClientTimeout(const HttpClient *this)
|
httpClientTimeout(const HttpClient *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpClient)->timeout;
|
||||||
return ((const HttpClientPub *)this)->timeout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -91,32 +91,28 @@ typedef struct HttpRequestPub
|
|||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
httpRequestPath(const HttpRequest *this)
|
httpRequestPath(const HttpRequest *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpRequest)->path;
|
||||||
return ((const HttpRequestPub *)this)->path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request query
|
// Request query
|
||||||
__attribute__((always_inline)) static inline const HttpQuery *
|
__attribute__((always_inline)) static inline const HttpQuery *
|
||||||
httpRequestQuery(const HttpRequest *this)
|
httpRequestQuery(const HttpRequest *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpRequest)->query;
|
||||||
return ((const HttpRequestPub *)this)->query;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request headers
|
// Request headers
|
||||||
__attribute__((always_inline)) static inline const HttpHeader *
|
__attribute__((always_inline)) static inline const HttpHeader *
|
||||||
httpRequestHeader(const HttpRequest *this)
|
httpRequestHeader(const HttpRequest *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpRequest)->header;
|
||||||
return ((const HttpRequestPub *)this)->header;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request verb
|
// Request verb
|
||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
httpRequestVerb(const HttpRequest *this)
|
httpRequestVerb(const HttpRequest *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpRequest)->verb;
|
||||||
return ((const HttpRequestPub *)this)->verb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -46,32 +46,28 @@ typedef struct HttpResponsePub
|
|||||||
__attribute__((always_inline)) static inline IoRead *
|
__attribute__((always_inline)) static inline IoRead *
|
||||||
httpResponseIoRead(HttpResponse *this)
|
httpResponseIoRead(HttpResponse *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpResponse)->contentRead;
|
||||||
return ((const HttpResponsePub *)this)->contentRead;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response code
|
// Response code
|
||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
httpResponseCode(const HttpResponse *this)
|
httpResponseCode(const HttpResponse *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpResponse)->code;
|
||||||
return ((const HttpResponsePub *)this)->code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response headers
|
// Response headers
|
||||||
__attribute__((always_inline)) static inline const HttpHeader *
|
__attribute__((always_inline)) static inline const HttpHeader *
|
||||||
httpResponseHeader(const HttpResponse *this)
|
httpResponseHeader(const HttpResponse *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpResponse)->header;
|
||||||
return ((const HttpResponsePub *)this)->header;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response reason
|
// Response reason
|
||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
httpResponseReason(const HttpResponse *this)
|
httpResponseReason(const HttpResponse *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpResponse)->reason;
|
||||||
return ((const HttpResponsePub *)this)->reason;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -56,40 +56,35 @@ typedef struct HttpUrlPub
|
|||||||
__attribute__((always_inline)) static inline HttpProtocolType
|
__attribute__((always_inline)) static inline HttpProtocolType
|
||||||
httpUrlProtocolType(const HttpUrl *this)
|
httpUrlProtocolType(const HttpUrl *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpUrl)->type;
|
||||||
return ((const HttpUrlPub *)this)->type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Host
|
// Host
|
||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
httpUrlHost(const HttpUrl *this)
|
httpUrlHost(const HttpUrl *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpUrl)->host;
|
||||||
return ((const HttpUrlPub *)this)->host;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path
|
// Path
|
||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
httpUrlPath(const HttpUrl *this)
|
httpUrlPath(const HttpUrl *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpUrl)->path;
|
||||||
return ((const HttpUrlPub *)this)->path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Port
|
// Port
|
||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
httpUrlPort(const HttpUrl *this)
|
httpUrlPort(const HttpUrl *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpUrl)->port;
|
||||||
return ((const HttpUrlPub *)this)->port;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// URL (exactly as originally passed)
|
// URL (exactly as originally passed)
|
||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
httpUrl(const HttpUrl *this)
|
httpUrl(const HttpUrl *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(HttpUrl)->url;
|
||||||
return ((const HttpUrlPub *)this)->url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -26,25 +26,22 @@ Getters/Setters
|
|||||||
__attribute__((always_inline)) static inline bool
|
__attribute__((always_inline)) static inline bool
|
||||||
ioReadBlock(const IoRead *const this)
|
ioReadBlock(const IoRead *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoRead)->interface.block;
|
||||||
return ((IoReadPub *)this)->interface.block;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is IO at EOF? All driver reads are complete and all data has been flushed from the filters (if any).
|
// Is IO at EOF? All driver reads are complete and all data has been flushed from the filters (if any).
|
||||||
__attribute__((always_inline)) static inline bool
|
__attribute__((always_inline)) static inline bool
|
||||||
ioReadEof(const IoRead *const this)
|
ioReadEof(const IoRead *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
ASSERT_INLINE(THIS_PUB(IoRead)->opened && !THIS_PUB(IoRead)->closed);
|
||||||
ASSERT_INLINE(((IoReadPub *)this)->opened && !((IoReadPub *)this)->closed);
|
return THIS_PUB(IoRead)->eofAll;
|
||||||
return ((const IoReadPub *)this)->eofAll;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get filter group if filters need to be added
|
// Get filter group if filters need to be added
|
||||||
__attribute__((always_inline)) static inline IoFilterGroup *
|
__attribute__((always_inline)) static inline IoFilterGroup *
|
||||||
ioReadFilterGroup(IoRead *const this)
|
ioReadFilterGroup(IoRead *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoRead)->filterGroup;
|
||||||
return ((IoReadPub *)this)->filterGroup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// File descriptor for the read object. Not all read objects have a file descriptor and -1 will be returned in that case.
|
// File descriptor for the read object. Not all read objects have a file descriptor and -1 will be returned in that case.
|
||||||
@ -69,7 +66,6 @@ String *ioReadLineParam(IoRead *this, bool allowEof);
|
|||||||
__attribute__((always_inline)) static inline String *
|
__attribute__((always_inline)) static inline String *
|
||||||
ioReadLine(IoRead *const this)
|
ioReadLine(IoRead *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
|
||||||
return ioReadLineParam(this, false);
|
return ioReadLineParam(this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,16 +53,14 @@ typedef struct IoReadPub
|
|||||||
__attribute__((always_inline)) static inline void *
|
__attribute__((always_inline)) static inline void *
|
||||||
ioReadDriver(IoRead *const this)
|
ioReadDriver(IoRead *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoRead)->driver;
|
||||||
return ((IoReadPub *)this)->driver;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface for the read object
|
// Interface for the read object
|
||||||
__attribute__((always_inline)) static inline const IoReadInterface *
|
__attribute__((always_inline)) static inline const IoReadInterface *
|
||||||
ioReadInterface(const IoRead *this)
|
ioReadInterface(const IoRead *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return &THIS_PUB(IoRead)->interface;
|
||||||
return &((IoReadPub *)this)->interface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -43,24 +43,21 @@ int ioSessionFd(IoSession *this);
|
|||||||
__attribute__((always_inline)) static inline IoRead *
|
__attribute__((always_inline)) static inline IoRead *
|
||||||
ioSessionIoRead(IoSession *const this)
|
ioSessionIoRead(IoSession *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoSession)->interface->ioRead(THIS_PUB(IoSession)->driver);
|
||||||
return ((IoSessionPub *)this)->interface->ioRead(((IoSessionPub *)this)->driver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write interface
|
// Write interface
|
||||||
__attribute__((always_inline)) static inline IoWrite *
|
__attribute__((always_inline)) static inline IoWrite *
|
||||||
ioSessionIoWrite(IoSession *const this)
|
ioSessionIoWrite(IoSession *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoSession)->interface->ioWrite(THIS_PUB(IoSession)->driver);
|
||||||
return ((IoSessionPub *)this)->interface->ioWrite(((IoSessionPub *)this)->driver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Session role
|
// Session role
|
||||||
__attribute__((always_inline)) static inline IoSessionRole
|
__attribute__((always_inline)) static inline IoSessionRole
|
||||||
ioSessionRole(const IoSession *const this)
|
ioSessionRole(const IoSession *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoSession)->interface->role(THIS_PUB(IoSession)->driver);
|
||||||
return ((const IoSessionPub *)this)->interface->role(((const IoSessionPub *)this)->driver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@ -70,8 +67,7 @@ Functions
|
|||||||
__attribute__((always_inline)) static inline void
|
__attribute__((always_inline)) static inline void
|
||||||
ioSessionClose(IoSession *const this)
|
ioSessionClose(IoSession *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoSession)->interface->close(THIS_PUB(IoSession)->driver);
|
||||||
return ((IoSessionPub *)this)->interface->close(((IoSessionPub *)this)->driver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move to a new parent mem context
|
// Move to a new parent mem context
|
||||||
|
@ -31,8 +31,7 @@ typedef struct IoWritePub
|
|||||||
__attribute__((always_inline)) static inline IoFilterGroup *
|
__attribute__((always_inline)) static inline IoFilterGroup *
|
||||||
ioWriteFilterGroup(IoWrite *const this)
|
ioWriteFilterGroup(IoWrite *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(IoWrite)->filterGroup;
|
||||||
return ((IoWritePub *)this)->filterGroup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// File descriptor for the write object. Not all write objects have a file descriptor and -1 will be returned in that case.
|
// File descriptor for the write object. Not all write objects have a file descriptor and -1 will be returned in that case.
|
||||||
|
@ -36,8 +36,7 @@ typedef struct KeyValuePub
|
|||||||
__attribute__((always_inline)) static inline const VariantList *
|
__attribute__((always_inline)) static inline const VariantList *
|
||||||
kvKeyList(const KeyValue *const this)
|
kvKeyList(const KeyValue *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(KeyValue)->keyList;
|
||||||
return ((KeyValuePub *)this)->keyList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -77,16 +77,14 @@ List *lstComparatorSet(List *this, ListComparator *comparator);
|
|||||||
__attribute__((always_inline)) static inline MemContext *
|
__attribute__((always_inline)) static inline MemContext *
|
||||||
lstMemContext(const List *this)
|
lstMemContext(const List *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(List)->memContext;
|
||||||
return ((const ListPub *)this)->memContext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// List size
|
// List size
|
||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
lstSize(const List *this)
|
lstSize(const List *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(List)->listSize;
|
||||||
return ((const ListPub *)this)->listSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is the list empty?
|
// Is the list empty?
|
||||||
|
@ -6,6 +6,7 @@ These macros and functions implement common object functionality.
|
|||||||
#ifndef COMMON_TYPE_OBJECT_H
|
#ifndef COMMON_TYPE_OBJECT_H
|
||||||
#define COMMON_TYPE_OBJECT_H
|
#define COMMON_TYPE_OBJECT_H
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
||||||
#include "common/memContext.h"
|
#include "common/memContext.h"
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@ -22,6 +23,27 @@ Create a local "this" variable of the correct type from a THIS_VOID parameter
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define THIS(type) type *this = thisVoid
|
#define THIS(type) type *this = thisVoid
|
||||||
|
|
||||||
|
/***********************************************************************************************************************************
|
||||||
|
Cast this private struct, e.g. List, to the associated public struct, e.g. ListPub. Note that the public struct must be the first
|
||||||
|
member of the private struct. For example:
|
||||||
|
|
||||||
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
|
lstSize(const List *const this)
|
||||||
|
{
|
||||||
|
return THIS_PUB(List)->listSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
The macro also ensures that this != NULL so there is no need to do that in the calling function.
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
#define THIS_PUB(type) ((type##Pub *)thisNotNull(this))
|
||||||
|
|
||||||
|
__attribute__((always_inline)) static inline const void *
|
||||||
|
thisNotNull(const void *const this)
|
||||||
|
{
|
||||||
|
ASSERT_INLINE(this != NULL);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Functions
|
Functions
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ Buffer *xmlDocumentBuf(const XmlDocument *this);
|
|||||||
__attribute__((always_inline)) static inline XmlNode *
|
__attribute__((always_inline)) static inline XmlNode *
|
||||||
xmlDocumentRoot(const XmlDocument *const this)
|
xmlDocumentRoot(const XmlDocument *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
|
||||||
return ((XmlDocumentPub *const)this)->root;
|
return ((XmlDocumentPub *const)this)->root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,8 +30,7 @@ typedef struct WaitPub
|
|||||||
__attribute__((always_inline)) static inline TimeMSec
|
__attribute__((always_inline)) static inline TimeMSec
|
||||||
waitRemaining(const Wait *this)
|
waitRemaining(const Wait *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Wait)->remainTime;
|
||||||
return ((const WaitPub *)this)->remainTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
12
src/db/db.h
12
src/db/db.h
@ -37,32 +37,28 @@ typedef struct DbPub
|
|||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
dbArchiveMode(const Db *const this)
|
dbArchiveMode(const Db *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Db)->archiveMode;
|
||||||
return ((DbPub *)this)->archiveMode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Archive command loaded from the archive_command GUC
|
// Archive command loaded from the archive_command GUC
|
||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
dbArchiveCommand(const Db *const this)
|
dbArchiveCommand(const Db *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Db)->archiveCommand;
|
||||||
return ((DbPub *)this)->archiveCommand;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data path loaded from the data_directory GUC
|
// Data path loaded from the data_directory GUC
|
||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
dbPgDataPath(const Db *const this)
|
dbPgDataPath(const Db *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Db)->pgDataPath;
|
||||||
return ((DbPub *)this)->pgDataPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Version loaded from the server_version_num GUC
|
// Version loaded from the server_version_num GUC
|
||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
dbPgVersion(const Db *const this)
|
dbPgVersion(const Db *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Db)->pgVersion;
|
||||||
return ((DbPub *)this)->pgVersion;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -55,8 +55,7 @@ typedef struct InfoPub
|
|||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
infoCipherPass(const Info *const this)
|
infoCipherPass(const Info *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Info)->cipherPass;
|
||||||
return ((InfoPub *)this)->cipherPass;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void infoCipherPassSet(Info *this, const String *cipherPass);
|
void infoCipherPassSet(Info *this, const String *cipherPass);
|
||||||
@ -65,8 +64,7 @@ void infoCipherPassSet(Info *this, const String *cipherPass);
|
|||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
infoBackrestVersion(const Info *const this)
|
infoBackrestVersion(const Info *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Info)->backrestVersion;
|
||||||
return ((InfoPub *)this)->backrestVersion;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -47,8 +47,7 @@ typedef struct InfoArchivePub
|
|||||||
__attribute__((always_inline)) static inline InfoPg *
|
__attribute__((always_inline)) static inline InfoPg *
|
||||||
infoArchivePg(const InfoArchive *const this)
|
infoArchivePg(const InfoArchive *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(InfoArchive)->infoPg;
|
||||||
return ((InfoArchivePub *)this)->infoPg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoArchive *infoArchivePgSet(InfoArchive *this, unsigned int pgVersion, uint64_t pgSystemId);
|
InfoArchive *infoArchivePgSet(InfoArchive *this, unsigned int pgVersion, uint64_t pgSystemId);
|
||||||
|
@ -77,8 +77,7 @@ typedef struct InfoBackupPub
|
|||||||
__attribute__((always_inline)) static inline InfoPg *
|
__attribute__((always_inline)) static inline InfoPg *
|
||||||
infoBackupPg(const InfoBackup *const this)
|
infoBackupPg(const InfoBackup *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(InfoBackup)->infoPg;
|
||||||
return ((InfoBackupPub *)this)->infoPg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoBackup *infoBackupPgSet(InfoBackup *this, unsigned int pgVersion, uint64_t pgSystemId, unsigned int pgCatalogVersion);
|
InfoBackup *infoBackupPgSet(InfoBackup *this, unsigned int pgVersion, uint64_t pgSystemId, unsigned int pgCatalogVersion);
|
||||||
@ -97,17 +96,15 @@ InfoBackupData infoBackupData(const InfoBackup *this, unsigned int backupDataIdx
|
|||||||
__attribute__((always_inline)) static inline InfoBackupData *
|
__attribute__((always_inline)) static inline InfoBackupData *
|
||||||
infoBackupDataByLabel(const InfoBackup *const this, const String *const backupLabel)
|
infoBackupDataByLabel(const InfoBackup *const this, const String *const backupLabel)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
|
||||||
ASSERT_INLINE(backupLabel != NULL);
|
ASSERT_INLINE(backupLabel != NULL);
|
||||||
return lstFind(((InfoBackupPub *)this)->backup, &backupLabel);
|
return lstFind(THIS_PUB(InfoBackup)->backup, &backupLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get total current backups
|
// Get total current backups
|
||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
infoBackupDataTotal(const InfoBackup *const this)
|
infoBackupDataTotal(const InfoBackup *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return lstSize(THIS_PUB(InfoBackup)->backup);
|
||||||
return lstSize(((InfoBackupPub *)this)->backup);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -66,8 +66,7 @@ String *infoPgArchiveId(const InfoPg *this, unsigned int pgDataIdx);
|
|||||||
__attribute__((always_inline)) static inline Info *
|
__attribute__((always_inline)) static inline Info *
|
||||||
infoPgInfo(const InfoPg *const this)
|
infoPgInfo(const InfoPg *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(InfoPg)->info;
|
||||||
return ((InfoPgPub *)this)->info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the cipher passphrase
|
// Return the cipher passphrase
|
||||||
@ -93,8 +92,7 @@ unsigned int infoPgDataCurrentId(const InfoPg *this);
|
|||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
infoPgDataTotal(const InfoPg *const this)
|
infoPgDataTotal(const InfoPg *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return lstSize(THIS_PUB(InfoPg)->history);
|
||||||
return lstSize(((InfoPgPub *)this)->history);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -177,23 +177,20 @@ typedef struct ManifestPub
|
|||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
manifestCipherSubPass(const Manifest *const this)
|
manifestCipherSubPass(const Manifest *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return infoCipherPass(THIS_PUB(Manifest)->info);
|
||||||
return infoCipherPass(((const ManifestPub *)this)->info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((always_inline)) static inline void
|
__attribute__((always_inline)) static inline void
|
||||||
manifestCipherSubPassSet(Manifest *const this, const String *const cipherSubPass)
|
manifestCipherSubPassSet(Manifest *const this, const String *const cipherSubPass)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
infoCipherPassSet(THIS_PUB(Manifest)->info, cipherSubPass);
|
||||||
infoCipherPassSet(((const ManifestPub *)this)->info, cipherSubPass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get manifest configuration and options
|
// Get manifest configuration and options
|
||||||
__attribute__((always_inline)) static inline const ManifestData *
|
__attribute__((always_inline)) static inline const ManifestData *
|
||||||
manifestData(const Manifest *const this)
|
manifestData(const Manifest *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return &(THIS_PUB(Manifest)->data);
|
||||||
return &(((const ManifestPub *)this)->data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set backup label
|
// Set backup label
|
||||||
@ -240,8 +237,7 @@ Db functions and getters/setters
|
|||||||
__attribute__((always_inline)) static inline const ManifestDb *
|
__attribute__((always_inline)) static inline const ManifestDb *
|
||||||
manifestDb(const Manifest *const this, const unsigned int dbIdx)
|
manifestDb(const Manifest *const this, const unsigned int dbIdx)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return lstGet(THIS_PUB(Manifest)->dbList, dbIdx);
|
||||||
return lstGet(((const ManifestPub *)this)->dbList, dbIdx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ManifestDb *manifestDbFind(const Manifest *this, const String *name);
|
const ManifestDb *manifestDbFind(const Manifest *this, const String *name);
|
||||||
@ -250,16 +246,14 @@ const ManifestDb *manifestDbFind(const Manifest *this, const String *name);
|
|||||||
__attribute__((always_inline)) static inline const ManifestDb *
|
__attribute__((always_inline)) static inline const ManifestDb *
|
||||||
manifestDbFindDefault(const Manifest *const this, const String *const name, const ManifestDb *const dbDefault)
|
manifestDbFindDefault(const Manifest *const this, const String *const name, const ManifestDb *const dbDefault)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
|
||||||
ASSERT_INLINE(name != NULL);
|
ASSERT_INLINE(name != NULL);
|
||||||
return lstFindDefault(((const ManifestPub *)this)->dbList, &name, (void *)dbDefault);
|
return lstFindDefault(THIS_PUB(Manifest)->dbList, &name, (void *)dbDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
manifestDbTotal(const Manifest *const this)
|
manifestDbTotal(const Manifest *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return lstSize(THIS_PUB(Manifest)->dbList);
|
||||||
return lstSize(((const ManifestPub *)this)->dbList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@ -268,8 +262,7 @@ File functions and getters/setters
|
|||||||
__attribute__((always_inline)) static inline const ManifestFile *
|
__attribute__((always_inline)) static inline const ManifestFile *
|
||||||
manifestFile(const Manifest *const this, const unsigned int fileIdx)
|
manifestFile(const Manifest *const this, const unsigned int fileIdx)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return lstGet(THIS_PUB(Manifest)->fileList, fileIdx);
|
||||||
return lstGet(((const ManifestPub *)this)->fileList, fileIdx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void manifestFileAdd(Manifest *this, const ManifestFile *file);
|
void manifestFileAdd(Manifest *this, const ManifestFile *file);
|
||||||
@ -279,9 +272,8 @@ const ManifestFile *manifestFileFind(const Manifest *this, const String *name);
|
|||||||
__attribute__((always_inline)) static inline const ManifestFile *
|
__attribute__((always_inline)) static inline const ManifestFile *
|
||||||
manifestFileFindDefault(const Manifest *const this, const String *const name, const ManifestFile *const fileDefault)
|
manifestFileFindDefault(const Manifest *const this, const String *const name, const ManifestFile *const fileDefault)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
|
||||||
ASSERT_INLINE(name != NULL);
|
ASSERT_INLINE(name != NULL);
|
||||||
return lstFindDefault(((const ManifestPub *)this)->fileList, &name, (void *)fileDefault);
|
return lstFindDefault(THIS_PUB(Manifest)->fileList, &name, (void *)fileDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
void manifestFileRemove(const Manifest *this, const String *name);
|
void manifestFileRemove(const Manifest *this, const String *name);
|
||||||
@ -289,8 +281,7 @@ void manifestFileRemove(const Manifest *this, const String *name);
|
|||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
manifestFileTotal(const Manifest *const this)
|
manifestFileTotal(const Manifest *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return lstSize(THIS_PUB(Manifest)->fileList);
|
||||||
return lstSize(((const ManifestPub *)this)->fileList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update a file with new data
|
// Update a file with new data
|
||||||
@ -304,8 +295,7 @@ Link functions and getters/setters
|
|||||||
__attribute__((always_inline)) static inline const ManifestLink *
|
__attribute__((always_inline)) static inline const ManifestLink *
|
||||||
manifestLink(const Manifest *const this, const unsigned int linkIdx)
|
manifestLink(const Manifest *const this, const unsigned int linkIdx)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return lstGet(THIS_PUB(Manifest)->linkList, linkIdx);
|
||||||
return lstGet(((const ManifestPub *)this)->linkList, linkIdx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ManifestLink *manifestLinkFind(const Manifest *this, const String *name);
|
const ManifestLink *manifestLinkFind(const Manifest *this, const String *name);
|
||||||
@ -314,9 +304,8 @@ const ManifestLink *manifestLinkFind(const Manifest *this, const String *name);
|
|||||||
__attribute__((always_inline)) static inline const ManifestLink *
|
__attribute__((always_inline)) static inline const ManifestLink *
|
||||||
manifestLinkFindDefault(const Manifest *const this, const String *const name, const ManifestLink *const linkDefault)
|
manifestLinkFindDefault(const Manifest *const this, const String *const name, const ManifestLink *const linkDefault)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
|
||||||
ASSERT_INLINE(name != NULL);
|
ASSERT_INLINE(name != NULL);
|
||||||
return lstFindDefault(((const ManifestPub *)this)->linkList, &name, (void *)linkDefault);
|
return lstFindDefault(THIS_PUB(Manifest)->linkList, &name, (void *)linkDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
void manifestLinkRemove(const Manifest *this, const String *name);
|
void manifestLinkRemove(const Manifest *this, const String *name);
|
||||||
@ -324,8 +313,7 @@ void manifestLinkRemove(const Manifest *this, const String *name);
|
|||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
manifestLinkTotal(const Manifest *const this)
|
manifestLinkTotal(const Manifest *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return lstSize(THIS_PUB(Manifest)->linkList);
|
||||||
return lstSize(((const ManifestPub *)this)->linkList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void manifestLinkUpdate(const Manifest *this, const String *name, const String *path);
|
void manifestLinkUpdate(const Manifest *this, const String *name, const String *path);
|
||||||
@ -336,8 +324,7 @@ Path functions and getters/setters
|
|||||||
__attribute__((always_inline)) static inline const ManifestPath *
|
__attribute__((always_inline)) static inline const ManifestPath *
|
||||||
manifestPath(const Manifest *const this, const unsigned int pathIdx)
|
manifestPath(const Manifest *const this, const unsigned int pathIdx)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return lstGet(THIS_PUB(Manifest)->pathList, pathIdx);
|
||||||
return lstGet(((const ManifestPub *)this)->pathList, pathIdx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ManifestPath *manifestPathFind(const Manifest *this, const String *name);
|
const ManifestPath *manifestPathFind(const Manifest *this, const String *name);
|
||||||
@ -346,9 +333,8 @@ const ManifestPath *manifestPathFind(const Manifest *this, const String *name);
|
|||||||
__attribute__((always_inline)) static inline const ManifestPath *
|
__attribute__((always_inline)) static inline const ManifestPath *
|
||||||
manifestPathFindDefault(const Manifest *const this, const String *const name, const ManifestPath *const pathDefault)
|
manifestPathFindDefault(const Manifest *const this, const String *const name, const ManifestPath *const pathDefault)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
|
||||||
ASSERT_INLINE(name != NULL);
|
ASSERT_INLINE(name != NULL);
|
||||||
return lstFindDefault(((const ManifestPub *)this)->pathList, &name, (void *)pathDefault);
|
return lstFindDefault(THIS_PUB(Manifest)->pathList, &name, (void *)pathDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data directory relative path for any manifest file/link/path/target name
|
// Data directory relative path for any manifest file/link/path/target name
|
||||||
@ -357,8 +343,7 @@ String *manifestPathPg(const String *manifestPath);
|
|||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
manifestPathTotal(const Manifest *const this)
|
manifestPathTotal(const Manifest *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return lstSize(THIS_PUB(Manifest)->pathList);
|
||||||
return lstSize(((const ManifestPub *)this)->pathList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@ -367,8 +352,7 @@ Target functions and getters/setters
|
|||||||
__attribute__((always_inline)) static inline const ManifestTarget *
|
__attribute__((always_inline)) static inline const ManifestTarget *
|
||||||
manifestTarget(const Manifest *const this, const unsigned int targetIdx)
|
manifestTarget(const Manifest *const this, const unsigned int targetIdx)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return lstGet(THIS_PUB(Manifest)->targetList, targetIdx);
|
||||||
return lstGet(((const ManifestPub *)this)->targetList, targetIdx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ManifestTarget *manifestTargetFind(const Manifest *this, const String *name);
|
const ManifestTarget *manifestTargetFind(const Manifest *this, const String *name);
|
||||||
@ -388,8 +372,7 @@ void manifestTargetRemove(const Manifest *this, const String *name);
|
|||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
manifestTargetTotal(const Manifest *const this)
|
manifestTargetTotal(const Manifest *const this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return lstSize(THIS_PUB(Manifest)->targetList);
|
||||||
return lstSize(((const ManifestPub *)this)->targetList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void manifestTargetUpdate(const Manifest *this, const String *name, const String *path, const String *file);
|
void manifestTargetUpdate(const Manifest *this, const String *name, const String *path, const String *file);
|
||||||
|
@ -56,16 +56,14 @@ typedef struct ProtocolClientPub
|
|||||||
__attribute__((always_inline)) static inline IoRead *
|
__attribute__((always_inline)) static inline IoRead *
|
||||||
protocolClientIoRead(ProtocolClient *this)
|
protocolClientIoRead(ProtocolClient *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(ProtocolClient)->read;
|
||||||
return ((ProtocolClientPub *)this)->read;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write interface
|
// Write interface
|
||||||
__attribute__((always_inline)) static inline IoWrite *
|
__attribute__((always_inline)) static inline IoWrite *
|
||||||
protocolClientIoWrite(ProtocolClient *this)
|
protocolClientIoWrite(ProtocolClient *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(ProtocolClient)->write;
|
||||||
return ((ProtocolClientPub *)this)->write;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -47,23 +47,20 @@ typedef struct ProtocolParallelJobPub
|
|||||||
__attribute__((always_inline)) static inline const ProtocolCommand *
|
__attribute__((always_inline)) static inline const ProtocolCommand *
|
||||||
protocolParallelJobCommand(const ProtocolParallelJob *this)
|
protocolParallelJobCommand(const ProtocolParallelJob *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(ProtocolParallelJob)->command;
|
||||||
return ((ProtocolParallelJobPub *)this)->command;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Job error
|
// Job error
|
||||||
__attribute__((always_inline)) static inline int
|
__attribute__((always_inline)) static inline int
|
||||||
protocolParallelJobErrorCode(const ProtocolParallelJob *this)
|
protocolParallelJobErrorCode(const ProtocolParallelJob *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(ProtocolParallelJob)->code;
|
||||||
return ((ProtocolParallelJobPub *)this)->code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
protocolParallelJobErrorMessage(const ProtocolParallelJob *this)
|
protocolParallelJobErrorMessage(const ProtocolParallelJob *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(ProtocolParallelJob)->message;
|
||||||
return ((ProtocolParallelJobPub *)this)->message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void protocolParallelJobErrorSet(ProtocolParallelJob *this, int code, const String *message);
|
void protocolParallelJobErrorSet(ProtocolParallelJob *this, int code, const String *message);
|
||||||
@ -72,16 +69,14 @@ void protocolParallelJobErrorSet(ProtocolParallelJob *this, int code, const Stri
|
|||||||
__attribute__((always_inline)) static inline const Variant *
|
__attribute__((always_inline)) static inline const Variant *
|
||||||
protocolParallelJobKey(const ProtocolParallelJob *this)
|
protocolParallelJobKey(const ProtocolParallelJob *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(ProtocolParallelJob)->key;
|
||||||
return ((ProtocolParallelJobPub *)this)->key;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process Id
|
// Process Id
|
||||||
__attribute__((always_inline)) static inline unsigned int
|
__attribute__((always_inline)) static inline unsigned int
|
||||||
protocolParallelJobProcessId(const ProtocolParallelJob *this)
|
protocolParallelJobProcessId(const ProtocolParallelJob *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(ProtocolParallelJob)->processId;
|
||||||
return ((ProtocolParallelJobPub *)this)->processId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void protocolParallelJobProcessIdSet(ProtocolParallelJob *this, unsigned int processId);
|
void protocolParallelJobProcessIdSet(ProtocolParallelJob *this, unsigned int processId);
|
||||||
@ -90,8 +85,7 @@ void protocolParallelJobProcessIdSet(ProtocolParallelJob *this, unsigned int pro
|
|||||||
__attribute__((always_inline)) static inline const Variant *
|
__attribute__((always_inline)) static inline const Variant *
|
||||||
protocolParallelJobResult(const ProtocolParallelJob *this)
|
protocolParallelJobResult(const ProtocolParallelJob *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(ProtocolParallelJob)->result;
|
||||||
return ((ProtocolParallelJobPub *)this)->result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void protocolParallelJobResultSet(ProtocolParallelJob *this, const Variant *result);
|
void protocolParallelJobResultSet(ProtocolParallelJob *this, const Variant *result);
|
||||||
@ -100,8 +94,7 @@ void protocolParallelJobResultSet(ProtocolParallelJob *this, const Variant *resu
|
|||||||
__attribute__((always_inline)) static inline ProtocolParallelJobState
|
__attribute__((always_inline)) static inline ProtocolParallelJobState
|
||||||
protocolParallelJobState(const ProtocolParallelJob *this)
|
protocolParallelJobState(const ProtocolParallelJob *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(ProtocolParallelJob)->state;
|
||||||
return ((ProtocolParallelJobPub *)this)->state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void protocolParallelJobStateSet(ProtocolParallelJob *this, ProtocolParallelJobState state);
|
void protocolParallelJobStateSet(ProtocolParallelJob *this, ProtocolParallelJobState state);
|
||||||
|
@ -48,16 +48,14 @@ typedef struct ProtocolServerPub
|
|||||||
__attribute__((always_inline)) static inline IoRead *
|
__attribute__((always_inline)) static inline IoRead *
|
||||||
protocolServerIoRead(ProtocolServer *this)
|
protocolServerIoRead(ProtocolServer *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(ProtocolServer)->read;
|
||||||
return ((ProtocolServerPub *)this)->read;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write interface
|
// Write interface
|
||||||
__attribute__((always_inline)) static inline IoWrite *
|
__attribute__((always_inline)) static inline IoWrite *
|
||||||
protocolServerIoWrite(ProtocolServer *this)
|
protocolServerIoWrite(ProtocolServer *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(ProtocolServer)->write;
|
||||||
return ((ProtocolServerPub *)this)->write;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -36,40 +36,35 @@ typedef struct StorageReadPub
|
|||||||
__attribute__((always_inline)) static inline bool
|
__attribute__((always_inline)) static inline bool
|
||||||
storageReadIgnoreMissing(const StorageRead *this)
|
storageReadIgnoreMissing(const StorageRead *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageRead)->interface->ignoreMissing;
|
||||||
return ((const StorageReadPub *)this)->interface->ignoreMissing;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read interface
|
// Read interface
|
||||||
__attribute__((always_inline)) static inline IoRead *
|
__attribute__((always_inline)) static inline IoRead *
|
||||||
storageReadIo(const StorageRead *this)
|
storageReadIo(const StorageRead *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageRead)->io;
|
||||||
return ((const StorageReadPub *)this)->io;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is there a read limit? NULL for no limit.
|
// Is there a read limit? NULL for no limit.
|
||||||
__attribute__((always_inline)) static inline const Variant *
|
__attribute__((always_inline)) static inline const Variant *
|
||||||
storageReadLimit(const StorageRead *this)
|
storageReadLimit(const StorageRead *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageRead)->interface->limit;
|
||||||
return ((const StorageReadPub *)this)->interface->limit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// File name
|
// File name
|
||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
storageReadName(const StorageRead *this)
|
storageReadName(const StorageRead *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageRead)->interface->name;
|
||||||
return ((const StorageReadPub *)this)->interface->name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get file type
|
// Get file type
|
||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
storageReadType(const StorageRead *this)
|
storageReadType(const StorageRead *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageRead)->interface->type;
|
||||||
return ((const StorageReadPub *)this)->interface->type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -253,16 +253,14 @@ Getters/Setters
|
|||||||
__attribute__((always_inline)) static inline bool
|
__attribute__((always_inline)) static inline bool
|
||||||
storageFeature(const Storage *this, StorageFeature feature)
|
storageFeature(const Storage *this, StorageFeature feature)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Storage)->interface.feature >> feature & 1;
|
||||||
return ((const StoragePub *)this)->interface.feature >> feature & 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Storage type (posix, cifs, etc.)
|
// Storage type (posix, cifs, etc.)
|
||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
storageType(const Storage *this)
|
storageType(const Storage *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Storage)->type;
|
||||||
return ((const StoragePub *)this)->type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -293,16 +293,14 @@ typedef struct StoragePub
|
|||||||
__attribute__((always_inline)) static inline void *
|
__attribute__((always_inline)) static inline void *
|
||||||
storageDriver(const Storage *this)
|
storageDriver(const Storage *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Storage)->driver;
|
||||||
return ((const StoragePub *)this)->driver;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Storage interface
|
// Storage interface
|
||||||
__attribute__((always_inline)) static inline StorageInterface
|
__attribute__((always_inline)) static inline StorageInterface
|
||||||
storageInterface(const Storage *this)
|
storageInterface(const Storage *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(Storage)->interface;
|
||||||
return ((const StoragePub *)this)->interface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -40,72 +40,63 @@ typedef struct StorageWritePub
|
|||||||
__attribute__((always_inline)) static inline bool
|
__attribute__((always_inline)) static inline bool
|
||||||
storageWriteAtomic(const StorageWrite *this)
|
storageWriteAtomic(const StorageWrite *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageWrite)->interface->atomic;
|
||||||
return ((const StorageWritePub *)this)->interface->atomic;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will the path be created if required?
|
// Will the path be created if required?
|
||||||
__attribute__((always_inline)) static inline bool
|
__attribute__((always_inline)) static inline bool
|
||||||
storageWriteCreatePath(const StorageWrite *this)
|
storageWriteCreatePath(const StorageWrite *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageWrite)->interface->createPath;
|
||||||
return ((const StorageWritePub *)this)->interface->createPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write interface
|
// Write interface
|
||||||
__attribute__((always_inline)) static inline IoWrite *
|
__attribute__((always_inline)) static inline IoWrite *
|
||||||
storageWriteIo(const StorageWrite *this)
|
storageWriteIo(const StorageWrite *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageWrite)->io;
|
||||||
return ((const StorageWritePub *)this)->io;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// File mode
|
// File mode
|
||||||
__attribute__((always_inline)) static inline mode_t
|
__attribute__((always_inline)) static inline mode_t
|
||||||
storageWriteModeFile(const StorageWrite *this)
|
storageWriteModeFile(const StorageWrite *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageWrite)->interface->modeFile;
|
||||||
return ((const StorageWritePub *)this)->interface->modeFile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path mode (if the destination path needs to be create)
|
// Path mode (if the destination path needs to be create)
|
||||||
__attribute__((always_inline)) static inline mode_t
|
__attribute__((always_inline)) static inline mode_t
|
||||||
storageWriteModePath(const StorageWrite *this)
|
storageWriteModePath(const StorageWrite *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageWrite)->interface->modePath;
|
||||||
return ((const StorageWritePub *)this)->interface->modePath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// File name
|
// File name
|
||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
storageWriteName(const StorageWrite *this)
|
storageWriteName(const StorageWrite *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageWrite)->interface->name;
|
||||||
return ((const StorageWritePub *)this)->interface->name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will the file be synced before it is closed?
|
// Will the file be synced before it is closed?
|
||||||
__attribute__((always_inline)) static inline bool
|
__attribute__((always_inline)) static inline bool
|
||||||
storageWriteSyncFile(const StorageWrite *this)
|
storageWriteSyncFile(const StorageWrite *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageWrite)->interface->syncFile;
|
||||||
return ((const StorageWritePub *)this)->interface->syncFile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will the path be synced after the file is closed?
|
// Will the path be synced after the file is closed?
|
||||||
__attribute__((always_inline)) static inline bool
|
__attribute__((always_inline)) static inline bool
|
||||||
storageWriteSyncPath(const StorageWrite *this)
|
storageWriteSyncPath(const StorageWrite *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageWrite)->interface->syncPath;
|
||||||
return ((const StorageWritePub *)this)->interface->syncPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// File type
|
// File type
|
||||||
__attribute__((always_inline)) static inline const String *
|
__attribute__((always_inline)) static inline const String *
|
||||||
storageWriteType(const StorageWrite *this)
|
storageWriteType(const StorageWrite *this)
|
||||||
{
|
{
|
||||||
ASSERT_INLINE(this != NULL);
|
return THIS_PUB(StorageWrite)->interface->type;
|
||||||
return ((const StorageWritePub *)this)->interface->type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user