1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-27 00:21:08 +02:00

Add OBJECT_DEFINE_MOVE() macro.

The object *Move() functions are very repetitive so replace them with a macro that works similarly to OBJECT_DEFINE_FREE().
This commit is contained in:
David Steele
2019-08-30 14:36:02 -04:00
parent d1675b7e91
commit 05abab5e72
17 changed files with 48 additions and 286 deletions

View File

@ -28,6 +28,7 @@ struct PgClient
PGconn *connection;
};
OBJECT_DEFINE_MOVE(PG_CLIENT);
OBJECT_DEFINE_FREE(PG_CLIENT);
/***********************************************************************************************************************************
@ -358,25 +359,6 @@ pgClientClose(PgClient *this)
FUNCTION_LOG_RETURN_VOID();
}
/***********************************************************************************************************************************
Move the pg client object to a new context
***********************************************************************************************************************************/
PgClient *
pgClientMove(PgClient *this, MemContext *parentNew)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(PG_CLIENT, this);
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
FUNCTION_TEST_END();
ASSERT(parentNew != NULL);
if (this != NULL)
memContextMove(this->memContext, parentNew);
FUNCTION_TEST_RETURN(this);
}
/***********************************************************************************************************************************
Render as string for logging
***********************************************************************************************************************************/