You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-15 01:04:37 +02:00
Add macros for object free functions.
Most of the *Free() functions are pretty generic so add macros to make creating them as easy as possible. Create a distinction between *Free() functions that the caller uses to free memory and callbacks that free third-party resources. There are a number of cases where a driver needs to free resources but does not need a normal *Free() because it is handled by the interface. Add common/object.h for macros that make object maintenance easier. This pattern can also be used for many more object functions.
This commit is contained in:
@ -6,6 +6,7 @@ Protocol Parallel Job
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/object.h"
|
||||
#include "protocol/command.h"
|
||||
#include "protocol/parallelJob.h"
|
||||
|
||||
@ -26,6 +27,8 @@ struct ProtocolParallelJob
|
||||
const Variant *result; // Result if job was successful
|
||||
};
|
||||
|
||||
OBJECT_DEFINE_FREE(PROTOCOL_PARALLEL_JOB);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Create object
|
||||
***********************************************************************************************************************************/
|
||||
@ -297,19 +300,3 @@ protocolParallelJobToLog(const ProtocolParallelJob *this)
|
||||
strPtr(varToLog(this->key)), strPtr(protocolCommandToLog(this->command)), this->code, strPtr(strToLog(this->message)),
|
||||
strPtr(varToLog(this->result)));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Free object
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
protocolParallelJobFree(ProtocolParallelJob *this)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(PROTOCOL_PARALLEL_JOB, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
if (this != NULL)
|
||||
memContextFree(this->memContext);
|
||||
|
||||
FUNCTION_LOG_RETURN_VOID();
|
||||
}
|
||||
|
Reference in New Issue
Block a user