mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-06-20 01:17:49 +02:00
Remove lstNew() constructor in favor of lstNewP().
The old constructor was left around to reduce code churn during the migration but it just makes the code harder to read and search. Remove the old constructor and rename all remaining instances to lstNewP(), which by default has the same semantics.
This commit is contained in:
@@ -1298,7 +1298,7 @@ backupProcessQueue(Manifest *manifest, List **queueList)
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
// Create list of process queue
|
||||
*queueList = lstNew(sizeof(List *));
|
||||
*queueList = lstNewP(sizeof(List *));
|
||||
|
||||
// Generate the list of targets
|
||||
StringList *targetList = strLstNew();
|
||||
|
||||
@@ -569,7 +569,7 @@ removeExpiredArchive(InfoBackup *infoBackup, bool timeBasedFullRetention)
|
||||
}
|
||||
|
||||
// Get the data for the backup selected for retention and all backups associated with this archive id
|
||||
List *archiveIdBackupList = lstNew(sizeof(InfoBackupData));
|
||||
List *archiveIdBackupList = lstNewP(sizeof(InfoBackupData));
|
||||
InfoBackupData archiveRetentionBackup = {0};
|
||||
|
||||
for (unsigned int infoBackupIdx = 0; infoBackupIdx < infoBackupDataTotal(infoBackup); infoBackupIdx++)
|
||||
@@ -595,7 +595,7 @@ removeExpiredArchive(InfoBackup *infoBackup, bool timeBasedFullRetention)
|
||||
// important to preserve archive that is required to make the older backups consistent even though they
|
||||
// cannot be played any further forward with PITR.
|
||||
String *archiveExpireMax = NULL;
|
||||
List *archiveRangeList = lstNew(sizeof(ArchiveRange));
|
||||
List *archiveRangeList = lstNewP(sizeof(ArchiveRange));
|
||||
|
||||
// From the full list of backups, loop through those associated with this archiveId
|
||||
for (unsigned int backupListIdx = 0; backupListIdx < lstSize(archiveIdBackupList); backupListIdx++)
|
||||
|
||||
@@ -1709,7 +1709,7 @@ restoreProcessQueue(Manifest *manifest, List **queueList)
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
// Create list of process queue
|
||||
*queueList = lstNew(sizeof(List *));
|
||||
*queueList = lstNewP(sizeof(List *));
|
||||
|
||||
// Generate the list of processing queues (there is always at least one)
|
||||
StringList *targetList = strLstNew();
|
||||
|
||||
@@ -71,7 +71,7 @@ ioFilterGroupNew(void)
|
||||
{
|
||||
.memContext = memContextCurrent(),
|
||||
.done = false,
|
||||
.filterList = lstNew(sizeof(IoFilterData)),
|
||||
.filterList = lstNewP(sizeof(IoFilterData)),
|
||||
};
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
||||
@@ -55,7 +55,7 @@ httpClientNew(
|
||||
.memContext = MEM_CONTEXT_NEW(),
|
||||
.timeout = timeout,
|
||||
.tlsClient = tlsClientNew(sckClientNew(host, port, timeout), timeout, verifyPeer, caFile, caPath),
|
||||
.sessionReuseList = lstNew(sizeof(HttpSession *)),
|
||||
.sessionReuseList = lstNewP(sizeof(HttpSession *)),
|
||||
};
|
||||
|
||||
httpClientStat.object++;
|
||||
|
||||
@@ -55,7 +55,7 @@ kvNew(void)
|
||||
*this = (KeyValue)
|
||||
{
|
||||
.memContext = MEM_CONTEXT_NEW(),
|
||||
.list = lstNew(sizeof(KeyValuePair)),
|
||||
.list = lstNewP(sizeof(KeyValuePair)),
|
||||
.keyList = varLstNew(),
|
||||
};
|
||||
}
|
||||
|
||||
+1
-11
@@ -31,17 +31,7 @@ OBJECT_DEFINE_FREE(LIST);
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
List *
|
||||
lstNew(size_t itemSize)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(SIZE, itemSize);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RETURN(lstNewP(itemSize));
|
||||
}
|
||||
|
||||
List *
|
||||
lstNewParam(size_t itemSize, ListParam param)
|
||||
lstNew(size_t itemSize, ListParam param)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(SIZE, itemSize);
|
||||
|
||||
@@ -51,8 +51,6 @@ int lstComparatorStr(const void *item1, const void *item2);
|
||||
/***********************************************************************************************************************************
|
||||
Constructors
|
||||
***********************************************************************************************************************************/
|
||||
List *lstNew(size_t itemSize);
|
||||
|
||||
typedef struct ListParam
|
||||
{
|
||||
VAR_PARAM_HEADER;
|
||||
@@ -61,9 +59,9 @@ typedef struct ListParam
|
||||
} ListParam;
|
||||
|
||||
#define lstNewP(itemSize, ...) \
|
||||
lstNewParam(itemSize, (ListParam){VAR_PARAM_INIT, __VA_ARGS__})
|
||||
lstNew(itemSize, (ListParam){VAR_PARAM_INIT, __VA_ARGS__})
|
||||
|
||||
List *lstNewParam(size_t itemSize, ListParam param);
|
||||
List *lstNew(size_t itemSize, ListParam param);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
|
||||
@@ -41,7 +41,7 @@ mcvNew(void)
|
||||
*this = (MostCommonValue)
|
||||
{
|
||||
.memContext = MEM_CONTEXT_NEW(),
|
||||
.list = lstNew(sizeof(MostCommonValueEntry)),
|
||||
.list = lstNewP(sizeof(MostCommonValueEntry)),
|
||||
};
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
||||
@@ -13,13 +13,13 @@ Variant List Handler
|
||||
#include "common/type/variantList.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Wrapper for lstNew()
|
||||
Wrapper for lstNewP()
|
||||
***********************************************************************************************************************************/
|
||||
VariantList *
|
||||
varLstNew(void)
|
||||
{
|
||||
FUNCTION_TEST_VOID();
|
||||
FUNCTION_TEST_RETURN((VariantList *)lstNew(sizeof(Variant *)));
|
||||
FUNCTION_TEST_RETURN((VariantList *)lstNewP(sizeof(Variant *)));
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
|
||||
@@ -84,7 +84,7 @@ XmlNodeList *
|
||||
xmlNodeLstNew(void)
|
||||
{
|
||||
FUNCTION_TEST_VOID();
|
||||
FUNCTION_TEST_RETURN((XmlNodeList *)lstNew(sizeof(XmlNode *)));
|
||||
FUNCTION_TEST_RETURN((XmlNodeList *)lstNewP(sizeof(XmlNode *)));
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ dbProtocol(const String *command, const VariantList *paramList, ProtocolServer *
|
||||
{
|
||||
MEM_CONTEXT_PRIOR_BEGIN()
|
||||
{
|
||||
dbProtocolLocal.pgClientList = lstNew(sizeof(PgClient *));
|
||||
dbProtocolLocal.pgClientList = lstNewP(sizeof(PgClient *));
|
||||
}
|
||||
MEM_CONTEXT_PRIOR_END();
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ infoPgNewInternal(InfoPgType type)
|
||||
{
|
||||
.memContext = memContextCurrent(),
|
||||
.type = type,
|
||||
.history = lstNew(sizeof(InfoPgData)),
|
||||
.history = lstNewP(sizeof(InfoPgData)),
|
||||
};
|
||||
|
||||
FUNCTION_TEST_RETURN(this);
|
||||
|
||||
+3
-3
@@ -1719,9 +1719,9 @@ manifestNewLoad(IoRead *read)
|
||||
|
||||
MEM_CONTEXT_BEGIN(loadData.memContext)
|
||||
{
|
||||
loadData.fileFoundList = lstNew(sizeof(ManifestLoadFound));
|
||||
loadData.linkFoundList = lstNew(sizeof(ManifestLoadFound));
|
||||
loadData.pathFoundList = lstNew(sizeof(ManifestLoadFound));
|
||||
loadData.fileFoundList = lstNewP(sizeof(ManifestLoadFound));
|
||||
loadData.linkFoundList = lstNewP(sizeof(ManifestLoadFound));
|
||||
loadData.pathFoundList = lstNewP(sizeof(ManifestLoadFound));
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
|
||||
|
||||
@@ -61,8 +61,8 @@ protocolParallelNew(TimeMSec timeout, ParallelJobCallback *callbackFunction, voi
|
||||
.timeout = timeout,
|
||||
.callbackFunction = callbackFunction,
|
||||
.callbackData = callbackData,
|
||||
.clientList = lstNew(sizeof(ProtocolClient *)),
|
||||
.jobList = lstNew(sizeof(ProtocolParallelJob *)),
|
||||
.clientList = lstNewP(sizeof(ProtocolClient *)),
|
||||
.jobList = lstNewP(sizeof(ProtocolParallelJob *)),
|
||||
.state = protocolParallelJobStatePending,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ protocolServerNew(const String *name, const String *service, IoRead *read, IoWri
|
||||
.name = strDup(name),
|
||||
.read = read,
|
||||
.write = write,
|
||||
.handlerList = lstNew(sizeof(ProtocolServerProcessHandler)),
|
||||
.handlerList = lstNewP(sizeof(ProtocolServerProcessHandler)),
|
||||
};
|
||||
|
||||
// Send the protocol greeting
|
||||
|
||||
Reference in New Issue
Block a user