mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-30 05:39:12 +02:00
Use strLstAddZ() instead of strLstAdd() where possible.
Using STRDEF() to convert the zero-terminated string to a String has no performance advantage but generates more code.
This commit is contained in:
parent
7900660d3a
commit
ff45f463cf
@ -1481,7 +1481,7 @@ backupProcessQueue(const BackupData *const backupData, Manifest *const manifest,
|
||||
|
||||
// Generate the list of targets
|
||||
StringList *targetList = strLstNew();
|
||||
strLstAdd(targetList, STRDEF(MANIFEST_TARGET_PGDATA "/"));
|
||||
strLstAddZ(targetList, MANIFEST_TARGET_PGDATA "/");
|
||||
|
||||
for (unsigned int targetIdx = 0; targetIdx < manifestTargetTotal(manifest); targetIdx++)
|
||||
{
|
||||
|
@ -2003,7 +2003,7 @@ restoreProcessQueue(Manifest *manifest, List **queueList)
|
||||
|
||||
// Generate the list of processing queues (there is always at least one)
|
||||
StringList *targetList = strLstNew();
|
||||
strLstAdd(targetList, STRDEF(MANIFEST_TARGET_PGDATA "/"));
|
||||
strLstAddZ(targetList, MANIFEST_TARGET_PGDATA "/");
|
||||
|
||||
for (unsigned int targetIdx = 0; targetIdx < manifestTargetTotal(manifest); targetIdx++)
|
||||
{
|
||||
|
@ -499,7 +499,7 @@ testRun(void)
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||
hrnCfgArgRawZ(argList, cfgOptCipherPass, "custom2");
|
||||
strLstAdd(argList, STRDEF(STORAGE_PATH_BACKUP "/test/latest/pg_data/backup_label"));
|
||||
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/pg_data/backup_label");
|
||||
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||
|
||||
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(backupLabelBuffer)), "put");
|
||||
@ -755,7 +755,7 @@ testRun(void)
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||
strLstAdd(argList, STRDEF(STORAGE_PATH_BACKUP "/test/latest/pg_data/backup_label"));
|
||||
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/pg_data/backup_label");
|
||||
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||
|
||||
writeBuffer = bufNew(0);
|
||||
|
@ -125,7 +125,7 @@ testRun(void)
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
StringList *redactList = strLstNew();
|
||||
strLstAdd(redactList, STRDEF("key2"));
|
||||
strLstAddZ(redactList, "key2");
|
||||
|
||||
TEST_ASSIGN(query, httpQueryNewP(.redactList = redactList), "new query");
|
||||
|
||||
@ -158,7 +158,7 @@ testRun(void)
|
||||
TEST_TITLE("dup query with redaction");
|
||||
|
||||
StringList *redactList = strLstNew();
|
||||
strLstAdd(redactList, STRDEF("key1"));
|
||||
strLstAddZ(redactList, "key1");
|
||||
|
||||
TEST_ASSIGN(query, httpQueryDupP(query, .redactList = redactList), "dup query");
|
||||
TEST_RESULT_STR_Z(httpQueryToLog(query), "{key1: <redacted>, key2: 'value2a'}", "log output");
|
||||
@ -603,7 +603,7 @@ testRun(void)
|
||||
hrnServerScriptClose(http);
|
||||
|
||||
StringList *headerRedact = strLstNew();
|
||||
strLstAdd(headerRedact, STRDEF("hdr2"));
|
||||
strLstAddZ(headerRedact, "hdr2");
|
||||
headerRequest = httpHeaderNew(headerRedact);
|
||||
httpHeaderAdd(headerRequest, STRDEF("hdr1"), STRDEF("1"));
|
||||
httpHeaderAdd(headerRequest, STRDEF("hdr2"), STRDEF("2"));
|
||||
|
@ -460,7 +460,7 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_STR_Z(strLstJoin(list, ", "), "", "empty list");
|
||||
|
||||
strLstAdd(list, STRDEF("item1"));
|
||||
strLstAddZ(list, "item1");
|
||||
strLstAddZ(list, "item2");
|
||||
|
||||
TEST_RESULT_STR_Z(strLstJoin(list, ", "), "item1, item2", "list");
|
||||
|
@ -410,8 +410,8 @@ testRun(void)
|
||||
{
|
||||
StringList *listStr = strLstNew();
|
||||
|
||||
strLstAdd(listStr, STRDEF("string1"));
|
||||
strLstAdd(listStr, STRDEF("string2"));
|
||||
strLstAddZ(listStr, "string1");
|
||||
strLstAddZ(listStr, "string2");
|
||||
|
||||
TEST_RESULT_STRLST_Z(strLstNewVarLst(varLstNewStrLst(listStr)), "string1\nstring2\n", "variant list from string list");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user