You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-03 00:26:59 +02:00
Move extern function comments to headers.
This has been the policy for some time but due to migration pressure only new functions and refactors have been following this rule. Now it seems sensible to make a clean sweep and move all the comments that have not been moved already (i.e. most of them). Only obvious typos and gross inaccuracies in the comments have been fixed. For this most part this was a copy and paste operation. Useless comments, e.g. "New object", were not copied. Even so, there are surely many deficient comments left. Some rearranging was done where needed and functions were placed in the proper sections, e.g. "Constructors", "Functions", etc. A few function prototypes were found that not longer had an implementation. These were removed, but there may be more. The coding document has been updated to reflect this policy, which is not new but has never been documented.
This commit is contained in:
@ -40,9 +40,7 @@ OBJECT_DEFINE_FREE_RESOURCE_BEGIN(PG_CLIENT, LOG, logLevelTrace)
|
||||
}
|
||||
OBJECT_DEFINE_FREE_RESOURCE_END(LOG);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Create object
|
||||
***********************************************************************************************************************************/
|
||||
/**********************************************************************************************************************************/
|
||||
PgClient *
|
||||
pgClientNew(const String *host, const unsigned int port, const String *database, const String *user, const TimeMSec queryTimeout)
|
||||
{
|
||||
@ -119,9 +117,7 @@ pgClientEscape(const String *string)
|
||||
FUNCTION_TEST_RETURN(result);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Open connection to PostgreSQL
|
||||
***********************************************************************************************************************************/
|
||||
/**********************************************************************************************************************************/
|
||||
PgClient *
|
||||
pgClientOpen(PgClient *this)
|
||||
{
|
||||
@ -167,9 +163,7 @@ pgClientOpen(PgClient *this)
|
||||
FUNCTION_LOG_RETURN(PG_CLIENT, this);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Execute a query and return results
|
||||
***********************************************************************************************************************************/
|
||||
/**********************************************************************************************************************************/
|
||||
VariantList *
|
||||
pgClientQuery(PgClient *this, const String *query)
|
||||
{
|
||||
@ -340,9 +334,7 @@ pgClientQuery(PgClient *this, const String *query)
|
||||
FUNCTION_LOG_RETURN(VARIANT_LIST, result);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Close connection to PostgreSQL
|
||||
***********************************************************************************************************************************/
|
||||
/**********************************************************************************************************************************/
|
||||
void
|
||||
pgClientClose(PgClient *this)
|
||||
{
|
||||
@ -362,9 +354,7 @@ pgClientClose(PgClient *this)
|
||||
FUNCTION_LOG_RETURN_VOID();
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Render as string for logging
|
||||
***********************************************************************************************************************************/
|
||||
/**********************************************************************************************************************************/
|
||||
String *
|
||||
pgClientToLog(const PgClient *this)
|
||||
{
|
||||
|
@ -29,12 +29,18 @@ PgClient *pgClientNew(
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
// Open connection to PostgreSQL
|
||||
PgClient *pgClientOpen(PgClient *this);
|
||||
VariantList *pgClientQuery(PgClient *this, const String *query);
|
||||
void pgClientClose(PgClient *this);
|
||||
|
||||
// Move to a new parent mem context
|
||||
PgClient *pgClientMove(PgClient *this, MemContext *parentNew);
|
||||
|
||||
// Execute a query and return results
|
||||
VariantList *pgClientQuery(PgClient *this, const String *query);
|
||||
|
||||
// Close connection to PostgreSQL
|
||||
void pgClientClose(PgClient *this);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Destructor
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -358,9 +358,7 @@ pgInterfaceVersion(unsigned int pgVersion)
|
||||
FUNCTION_TEST_RETURN(result);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get the catalog version for a PostgreSQL version
|
||||
***********************************************************************************************************************************/
|
||||
/**********************************************************************************************************************************/
|
||||
uint32_t
|
||||
pgCatalogVersion(unsigned int pgVersion)
|
||||
{
|
||||
@ -371,9 +369,7 @@ pgCatalogVersion(unsigned int pgVersion)
|
||||
FUNCTION_TEST_RETURN(pgInterfaceVersion(pgVersion)->catalogVersion());
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get info from pg_control
|
||||
***********************************************************************************************************************************/
|
||||
/**********************************************************************************************************************************/
|
||||
PgControl
|
||||
pgControlFromBuffer(const Buffer *controlFile)
|
||||
{
|
||||
@ -426,9 +422,6 @@ pgControlFromBuffer(const Buffer *controlFile)
|
||||
FUNCTION_LOG_RETURN(PG_CONTROL, result);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get info from pg_control
|
||||
***********************************************************************************************************************************/
|
||||
PgControl
|
||||
pgControlFromFile(const Storage *storage)
|
||||
{
|
||||
@ -453,9 +446,7 @@ pgControlFromFile(const Storage *storage)
|
||||
FUNCTION_LOG_RETURN(PG_CONTROL, result);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get the control version for a PostgreSQL version
|
||||
***********************************************************************************************************************************/
|
||||
/**********************************************************************************************************************************/
|
||||
uint32_t
|
||||
pgControlVersion(unsigned int pgVersion)
|
||||
{
|
||||
@ -478,9 +469,7 @@ typedef struct PgWalCommon
|
||||
|
||||
#define PG_WAL_LONG_HEADER 0x0002
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get info from WAL header
|
||||
***********************************************************************************************************************************/
|
||||
/**********************************************************************************************************************************/
|
||||
PgWal
|
||||
pgWalFromBuffer(const Buffer *walBuffer)
|
||||
{
|
||||
@ -523,9 +512,6 @@ pgWalFromBuffer(const Buffer *walBuffer)
|
||||
FUNCTION_LOG_RETURN(PG_WAL, result);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get info from a WAL segment
|
||||
***********************************************************************************************************************************/
|
||||
PgWal
|
||||
pgWalFromFile(const String *walFile)
|
||||
{
|
||||
@ -730,9 +716,7 @@ pgXactPath(unsigned int pgVersion)
|
||||
FUNCTION_TEST_RETURN(pgVersion >= PG_VERSION_WAL_RENAME ? PG_PATH_PGXACT_STR : PG_PATH_PGCLOG_STR);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Create pg_control for testing
|
||||
***********************************************************************************************************************************/
|
||||
/**********************************************************************************************************************************/
|
||||
#ifdef DEBUG
|
||||
|
||||
Buffer *
|
||||
@ -759,9 +743,7 @@ pgControlTestToBuffer(PgControl pgControl)
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Create WAL for testing
|
||||
***********************************************************************************************************************************/
|
||||
/**********************************************************************************************************************************/
|
||||
#ifdef DEBUG
|
||||
|
||||
void
|
||||
@ -782,9 +764,7 @@ pgWalTestToBuffer(PgWal pgWal, Buffer *walBuffer)
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Convert version string to version number
|
||||
***********************************************************************************************************************************/
|
||||
/**********************************************************************************************************************************/
|
||||
unsigned int
|
||||
pgVersionFromStr(const String *version)
|
||||
{
|
||||
@ -823,9 +803,6 @@ pgVersionFromStr(const String *version)
|
||||
FUNCTION_LOG_RETURN(UINT, result);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Convert version number to string
|
||||
***********************************************************************************************************************************/
|
||||
String *
|
||||
pgVersionToStr(unsigned int version)
|
||||
{
|
||||
@ -839,9 +816,7 @@ pgVersionToStr(unsigned int version)
|
||||
FUNCTION_LOG_RETURN(STRING, result);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Render as string for logging
|
||||
***********************************************************************************************************************************/
|
||||
/**********************************************************************************************************************************/
|
||||
String *
|
||||
pgControlToLog(const PgControl *pgControl)
|
||||
{
|
||||
|
@ -112,13 +112,21 @@ typedef struct PgWal
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
// Get the catalog version for a PostgreSQL version
|
||||
uint32_t pgCatalogVersion(unsigned int pgVersion);
|
||||
|
||||
// Get info from pg_control
|
||||
PgControl pgControlFromFile(const Storage *storage);
|
||||
PgControl pgControlFromBuffer(const Buffer *controlFile);
|
||||
|
||||
// Get the control version for a PostgreSQL version
|
||||
uint32_t pgControlVersion(unsigned int pgVersion);
|
||||
|
||||
// Convert version string to version number and vice versa
|
||||
unsigned int pgVersionFromStr(const String *version);
|
||||
String *pgVersionToStr(unsigned int version);
|
||||
|
||||
// Get info from WAL header
|
||||
PgWal pgWalFromFile(const String *walFile);
|
||||
PgWal pgWalFromBuffer(const Buffer *walBuffer);
|
||||
|
||||
@ -154,7 +162,10 @@ const String *pgXactPath(unsigned int pgVersion);
|
||||
Test Functions
|
||||
***********************************************************************************************************************************/
|
||||
#ifdef DEBUG
|
||||
// Create pg_control for testing
|
||||
Buffer *pgControlTestToBuffer(PgControl pgControl);
|
||||
|
||||
// Create WAL for testing
|
||||
void pgWalTestToBuffer(PgWal pgWal, Buffer *walBuffer);
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user