pgbackrest.git / summary / log / commit / refs
commit ff45f463cf4d4521df5fd69b48bd553d862f0dc1
Author: David Steele <david@pgmasters.net>
Date: Mon Apr 25 15:58:30 2022 +0000
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.
src/command/backup/backup.c | 2 +-
src/command/restore/restore.c | 2 +-
test/src/module/command/repoTest.c | 4 ++--
test/src/module/common/ioHttpTest.c | 6 +++---
test/src/module/common/typeStringTest.c | 2 +-
test/src/module/common/typeVariantTest.c | 4 ++--
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/command/backup/backup.c b/src/command/backup/backup.c
index e83895a92..81db91270 100644
--- a/src/command/backup/backup.c
+++ b/src/command/backup/backup.c
@@ -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++)
{
diff --git a/src/command/restore/restore.c b/src/command/restore/restore.c
index cdac5152c..21ffaf20c 100644
--- a/src/command/restore/restore.c
+++ b/src/command/restore/restore.c
@@ -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++)
{
diff --git a/test/src/module/command/repoTest.c b/test/src/module/command/repoTest.c
index d90486614..cd2e3d2f2 100644
--- a/test/src/module/command/repoTest.c
+++ b/test/src/module/command/repoTest.c
@@ -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);
diff --git a/test/src/module/common/ioHttpTest.c b/test/src/module/common/ioHttpTest.c
index dcc06080d..7b0341ae2 100644
--- a/test/src/module/common/ioHttpTest.c
+++ b/test/src/module/common/ioHttpTest.c
@@ -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"));
diff --git a/test/src/module/common/typeStringTest.c b/test/src/module/common/typeStringTest.c
index 8f319e2cb..f5f0e5c9a 100644
--- a/test/src/module/common/typeStringTest.c
+++ b/test/src/module/common/typeStringTest.c
@@ -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");
diff --git a/test/src/module/common/typeVariantTest.c b/test/src/module/common/typeVariantTest.c
index 37e119c02..e268a2acb 100644
--- a/test/src/module/common/typeVariantTest.c
+++ b/test/src/module/common/typeVariantTest.c
@@ -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");
[parent: 7900660d3a12]