You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-15 01:04:37 +02:00
Add MAX_ASSIGN() macro.
This improves coverage in cases where the compared values may be always ascending or descending.
This commit is contained in:
@ -7,7 +7,7 @@ General Macros
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Convert the parameter to a zero-terminated string
|
Convert the parameter to a zero-terminated string
|
||||||
|
|
||||||
This is useful for converting non-string types (e.g. int) to strings for inclusion in messages.
|
Useful for converting non-string types (e.g. int) to strings for inclusion in messages.
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
#define STRINGIFY_HELPER(param) #param
|
#define STRINGIFY_HELPER(param) #param
|
||||||
#define STRINGIFY(param) STRINGIFY_HELPER(param)
|
#define STRINGIFY(param) STRINGIFY_HELPER(param)
|
||||||
@ -21,4 +21,17 @@ common/object.h has numerous examples of this.
|
|||||||
#define GLUE_HELPER(param1, param2) param1##param2
|
#define GLUE_HELPER(param1, param2) param1##param2
|
||||||
#define GLUE(param1, param2) GLUE_HELPER(param1, param2)
|
#define GLUE(param1, param2) GLUE_HELPER(param1, param2)
|
||||||
|
|
||||||
|
/***********************************************************************************************************************************
|
||||||
|
If param2 > param1 then assign it to param1
|
||||||
|
|
||||||
|
Useful for ensuring coverage in cases where compared values may be always ascending or decending.
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
#define MAX_ASSIGN(param1, param2) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if (param2 > param1) \
|
||||||
|
param1 = param2; \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -147,9 +147,8 @@ protocolParallelProcess(ProtocolParallel *this)
|
|||||||
int handle = ioReadHandle(protocolClientIoRead(*(ProtocolClient **)lstGet(this->clientList, clientIdx)));
|
int handle = ioReadHandle(protocolClientIoRead(*(ProtocolClient **)lstGet(this->clientList, clientIdx)));
|
||||||
FD_SET((unsigned int)handle, &selectSet);
|
FD_SET((unsigned int)handle, &selectSet);
|
||||||
|
|
||||||
// Set the max handle
|
// Find the max file handle needed for select()
|
||||||
if (handle > handleMax) // {+uncovered_branch - often in ascending order}
|
MAX_ASSIGN(handleMax, handle);
|
||||||
handleMax = handle;
|
|
||||||
|
|
||||||
clientRunningTotal++;
|
clientRunningTotal++;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user