1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-05 00:28:52 +02:00

Simplify object creation with OBJ_NEW_BEGIN() macro.

Eliminate the boilerplate of declaring this and assigning memory to it, which is the same for the vast majority of object creations.

Keep the old version of the macro as OBJ_NEW_BASE_BEGIN() for a few exceptions in the core code and (mostly) in the tests.
This commit is contained in:
David Steele
2023-03-28 15:05:18 +06:00
parent 91f9301b9d
commit b111599bad
103 changed files with 77 additions and 506 deletions

View File

@ -53,12 +53,8 @@ pgClientNew(const String *host, const unsigned int port, const String *database,
ASSERT(port >= 1 && port <= 65535);
ASSERT(database != NULL);
PgClient *this = NULL;
OBJ_NEW_BEGIN(PgClient, .childQty = MEM_CONTEXT_QTY_MAX, .callbackQty = 1)
{
this = OBJ_NEW_ALLOC();
*this = (PgClient)
{
.pub =