You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-03 00:26:59 +02:00
Replace OBJECT_DEFINE_MOVE() and OBJECT_DEFINE_FREE() with inlines.
Inline functions are more efficient and if they are not used are automatically omitted from the binary. This also makes the implementation of these functions easier to find and removes the need for a declaration. That is, the complete implementation is located in the header rather than being spread between the header and C file.
This commit is contained in:
@ -9,7 +9,6 @@ Postgres Client
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/type/list.h"
|
||||
#include "common/type/object.h"
|
||||
#include "common/wait.h"
|
||||
#include "postgres/client.h"
|
||||
|
||||
@ -28,9 +27,6 @@ struct PgClient
|
||||
PGconn *connection;
|
||||
};
|
||||
|
||||
OBJECT_DEFINE_MOVE(PG_CLIENT);
|
||||
OBJECT_DEFINE_FREE(PG_CLIENT);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Close protocol connection
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -8,6 +8,7 @@ casts to queries to output one of these types.
|
||||
#ifndef POSTGRES_QUERY_H
|
||||
#define POSTGRES_QUERY_H
|
||||
|
||||
#include "common/type/object.h"
|
||||
#include "common/type/string.h"
|
||||
#include "common/type/variantList.h"
|
||||
#include "common/time.h"
|
||||
@ -15,9 +16,6 @@ casts to queries to output one of these types.
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
#define PG_CLIENT_TYPE PgClient
|
||||
#define PG_CLIENT_PREFIX pgClient
|
||||
|
||||
typedef struct PgClient PgClient;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -33,7 +31,11 @@ Functions
|
||||
PgClient *pgClientOpen(PgClient *this);
|
||||
|
||||
// Move to a new parent mem context
|
||||
PgClient *pgClientMove(PgClient *this, MemContext *parentNew);
|
||||
__attribute__((always_inline)) static inline PgClient *
|
||||
pgClientMove(PgClient *this, MemContext *parentNew)
|
||||
{
|
||||
return objMove(this, parentNew);
|
||||
}
|
||||
|
||||
// Execute a query and return results
|
||||
VariantList *pgClientQuery(PgClient *this, const String *query);
|
||||
@ -44,7 +46,11 @@ void pgClientClose(PgClient *this);
|
||||
/***********************************************************************************************************************************
|
||||
Destructor
|
||||
***********************************************************************************************************************************/
|
||||
void pgClientFree(PgClient *this);
|
||||
__attribute__((always_inline)) static inline void
|
||||
pgClientFree(PgClient *this)
|
||||
{
|
||||
objFree(this);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
|
Reference in New Issue
Block a user