You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-17 01:12:23 +02:00
Replace strCatFmt() with strCat()/strCatZ() where appropriate.
Most of these looked like copy/paste from a prior required strCatFmt() call. There is no issue here since strCatFmt() works the same in these cases, but using strCat()/strCatZ() is more efficient.
This commit is contained in:
@ -552,7 +552,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
|
||||
// Command parse rules
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
strCatFmt(
|
||||
strCatZ(
|
||||
config,
|
||||
"\n"
|
||||
COMMENT_BLOCK_BEGIN "\n"
|
||||
@ -566,7 +566,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
STRDEF("PARSE_RULE_VAL_CMD(value)"),
|
||||
strNewFmt("PARSE_RULE_U32_%zu(value)", bldCfgRenderVar128Size(lstSize(bldCfg.cmdList) - 1)))));
|
||||
|
||||
strCatFmt(
|
||||
strCatZ(
|
||||
config,
|
||||
"\n"
|
||||
"static const ParseRuleCommand parseRuleCommand[CFG_COMMAND_TOTAL] =\n"
|
||||
@ -602,7 +602,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
if (cmd->parameterAllowed)
|
||||
strCatZ(config, " PARSE_RULE_COMMAND_PARAMETER_ALLOWED(true),\n");
|
||||
|
||||
strCatFmt(
|
||||
strCatZ(
|
||||
config,
|
||||
"\n"
|
||||
" PARSE_RULE_COMMAND_ROLE_VALID_LIST\n"
|
||||
@ -628,7 +628,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
|
||||
// Option group rules
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
strCatFmt(
|
||||
strCatZ(
|
||||
config,
|
||||
"\n"
|
||||
COMMENT_BLOCK_BEGIN "\n"
|
||||
@ -659,7 +659,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
|
||||
// Option rules
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
strCatFmt(
|
||||
strCatZ(
|
||||
config,
|
||||
"\n"
|
||||
COMMENT_BLOCK_BEGIN "\n"
|
||||
@ -673,7 +673,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
STRDEF("PARSE_RULE_VAL_OPT(value)"),
|
||||
strNewFmt("PARSE_RULE_U32_%zu(value)", bldCfgRenderVar128Size(lstSize(bldCfg.optList) - 1)))));
|
||||
|
||||
strCatFmt(
|
||||
strCatZ(
|
||||
config,
|
||||
"\n"
|
||||
"static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =\n"
|
||||
@ -1079,7 +1079,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
|
||||
// Order for option parse resolution
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
strCatFmt(
|
||||
strCatZ(
|
||||
config,
|
||||
"\n"
|
||||
COMMENT_BLOCK_BEGIN "\n"
|
||||
@ -1104,7 +1104,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
|
||||
strLstSort(ruleStrList, sortOrderAsc);
|
||||
|
||||
strCatFmt(
|
||||
strCatZ(
|
||||
configVal,
|
||||
"\n"
|
||||
COMMENT_BLOCK_BEGIN "\n"
|
||||
@ -1118,7 +1118,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
STRDEF("PARSE_RULE_VAL_STR(value)"),
|
||||
strNewFmt("PARSE_RULE_U32_%zu(value)", bldCfgRenderVar128Size(strLstSize(ruleStrList) - 1)))));
|
||||
|
||||
strCatFmt(
|
||||
strCatZ(
|
||||
configVal,
|
||||
"\n"
|
||||
"static const StringPub parseRuleValueStr[] =\n"
|
||||
@ -1148,7 +1148,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
strLstSort(ruleStrIdList, sortOrderAsc);
|
||||
|
||||
strCatFmt(
|
||||
strCatZ(
|
||||
configVal,
|
||||
"\n"
|
||||
COMMENT_BLOCK_BEGIN "\n"
|
||||
@ -1162,7 +1162,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
STRDEF("PARSE_RULE_VAL_STRID(value)"),
|
||||
strNewFmt("PARSE_RULE_U32_%zu(value)", bldCfgRenderVar128Size(strLstSize(ruleStrIdList) - 1)))));
|
||||
|
||||
strCatFmt(
|
||||
strCatZ(
|
||||
configVal,
|
||||
"\n"
|
||||
"static const StringId parseRuleValueStrId[] =\n"
|
||||
@ -1188,7 +1188,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
strLstSort(ruleIntList, sortOrderAsc);
|
||||
|
||||
strCatFmt(
|
||||
strCatZ(
|
||||
configVal,
|
||||
"\n"
|
||||
COMMENT_BLOCK_BEGIN "\n"
|
||||
@ -1202,7 +1202,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
STRDEF("PARSE_RULE_VAL_INT(value)"),
|
||||
strNewFmt("PARSE_RULE_U32_%zu(value)", bldCfgRenderVar128Size(strLstSize(ruleIntList) - 1)))));
|
||||
|
||||
strCatFmt(
|
||||
strCatZ(
|
||||
configVal,
|
||||
"\n"
|
||||
"static const int64_t parseRuleValueInt[] =\n"
|
||||
|
@ -312,7 +312,7 @@ bldHlpRenderHelpAutoC(const Storage *const storageRepo, const BldCfg bldCfg, con
|
||||
|
||||
if (first)
|
||||
{
|
||||
strCatFmt(help, " ");
|
||||
strCatZ(help, " ");
|
||||
lineSize = 0;
|
||||
}
|
||||
|
||||
|
@ -52,14 +52,14 @@ cmdOption(void)
|
||||
|
||||
if (!strLstEmpty(commandParamList))
|
||||
{
|
||||
strCatFmt(cmdOptionStr, " [");
|
||||
strCatZ(cmdOptionStr, " [");
|
||||
|
||||
for (unsigned int commandParamIdx = 0; commandParamIdx < strLstSize(commandParamList); commandParamIdx++)
|
||||
{
|
||||
const String *commandParam = strLstGet(commandParamList, commandParamIdx);
|
||||
|
||||
if (commandParamIdx != 0)
|
||||
strCatFmt(cmdOptionStr, ", ");
|
||||
strCatZ(cmdOptionStr, ", ");
|
||||
|
||||
if (strchr(strZ(commandParam), ' ') != NULL)
|
||||
commandParam = strNewFmt("\"%s\"", strZ(commandParam));
|
||||
@ -67,7 +67,7 @@ cmdOption(void)
|
||||
strCat(cmdOptionStr, commandParam);
|
||||
}
|
||||
|
||||
strCatFmt(cmdOptionStr, "]");
|
||||
strCatZ(cmdOptionStr, "]");
|
||||
}
|
||||
|
||||
// Loop though options and add the ones that are interesting
|
||||
|
@ -1440,7 +1440,7 @@ infoRender(void)
|
||||
|
||||
// Add a carriage return between stanzas
|
||||
if (stanzaIdx > 0)
|
||||
strCatFmt(resultStr, "\n");
|
||||
strCatZ(resultStr, "\n");
|
||||
|
||||
// Stanza name and status
|
||||
strCatFmt(resultStr, "stanza: %s\n status: ", strZ(stanzaName));
|
||||
|
@ -1825,7 +1825,7 @@ restoreRecoveryWriteAutoConf(unsigned int pgVersion, const String *restoreLabel)
|
||||
}
|
||||
}
|
||||
|
||||
strCatFmt(content, "%s", strZ(restoreRecoveryConf(pgVersion, restoreLabel)));
|
||||
strCat(content, restoreRecoveryConf(pgVersion, restoreLabel));
|
||||
}
|
||||
|
||||
LOG_INFO_FMT(
|
||||
|
@ -373,7 +373,7 @@ cfgLoadLogFile(void)
|
||||
if (cfgCommandRole() == cfgCmdRoleLocal || cfgCommandRole() == cfgCmdRoleRemote)
|
||||
{
|
||||
if (cfgOptionValid(cfgOptArchiveAsync) && cfgOptionBool(cfgOptArchiveAsync))
|
||||
strCatFmt(logFile, "-async");
|
||||
strCatZ(logFile, "-async");
|
||||
}
|
||||
|
||||
// Add command role if it is not main
|
||||
|
16
src/db/db.c
16
src/db/db.c
@ -330,18 +330,18 @@ dbBackupStartQuery(unsigned int pgVersion, bool startFast)
|
||||
// Start backup after immediate checkpoint
|
||||
if (startFast)
|
||||
{
|
||||
strCatFmt(result, ", " TRUE_Z);
|
||||
strCatZ(result, ", " TRUE_Z);
|
||||
}
|
||||
// Else start backup at the next scheduled checkpoint
|
||||
else
|
||||
strCatFmt(result, ", " FALSE_Z);
|
||||
strCatZ(result, ", " FALSE_Z);
|
||||
|
||||
// Use non-exclusive backup mode when available
|
||||
if (pgVersion >= PG_VERSION_96)
|
||||
strCatFmt(result, ", " FALSE_Z);
|
||||
strCatZ(result, ", " FALSE_Z);
|
||||
|
||||
// Complete query
|
||||
strCatFmt(result, ") as lsn");
|
||||
strCatZ(result, ") as lsn");
|
||||
|
||||
FUNCTION_TEST_RETURN(result);
|
||||
}
|
||||
@ -501,17 +501,17 @@ dbBackupStopQuery(unsigned int pgVersion)
|
||||
|
||||
// Use non-exclusive backup mode when available
|
||||
if (pgVersion >= PG_VERSION_96)
|
||||
strCatFmt(result, FALSE_Z);
|
||||
strCatZ(result, FALSE_Z);
|
||||
|
||||
// Disable archive checking in pg_stop_backup() since we do this elsewhere
|
||||
if (pgVersion >= PG_VERSION_10)
|
||||
strCatFmt(result, ", " FALSE_Z);
|
||||
strCatZ(result, ", " FALSE_Z);
|
||||
|
||||
// Complete query
|
||||
strCatFmt(result, ")");
|
||||
strCatZ(result, ")");
|
||||
|
||||
if (pgVersion < PG_VERSION_96)
|
||||
strCatFmt(result, " as lsn");
|
||||
strCatZ(result, " as lsn");
|
||||
|
||||
FUNCTION_TEST_RETURN(result);
|
||||
}
|
||||
|
@ -99,9 +99,9 @@ testRequest(IoWrite *write, Storage *s3, const char *verb, const char *path, Tes
|
||||
if (s3 != NULL)
|
||||
{
|
||||
if (driver->uriStyle == storageS3UriStyleHost)
|
||||
strCatFmt(request, "host:bucket." S3_TEST_HOST "\r\n");
|
||||
strCatZ(request, "host:bucket." S3_TEST_HOST "\r\n");
|
||||
else
|
||||
strCatFmt(request, "host:" S3_TEST_HOST "\r\n");
|
||||
strCatZ(request, "host:" S3_TEST_HOST "\r\n");
|
||||
}
|
||||
else
|
||||
strCatFmt(request, "host:%s\r\n", strZ(hrnServerHost()));
|
||||
|
Reference in New Issue
Block a user