Add strCatZ().

strCat() did not follow our convention of appending Z to functions that accept zero-terminated strings rather than String objects.

Add strCatZ() to accept zero-terminated strings and update strCat() to accept String objects.

Use LF_STR where appropriate but don't use other String constants because they do not improve readability.
This commit is contained in:
David Steele
2020-06-24 12:09:24 -04:00
committed by GitHub
parent dab00e2010
commit 45d9b03136
29 changed files with 161 additions and 145 deletions
+1 -1
View File
@@ -1176,7 +1176,7 @@ backupJobResult(
// Add a comma if this is not the first item
if (errorIdx != 0)
strCat(error, ", ");
strCatZ(error, ", ");
// If an error range
if (varType(errorItem) == varTypeVariantList)
+6 -6
View File
@@ -44,21 +44,21 @@ backupRegExp(BackupRegExpParam param)
// If full requested then diff/incr is optional
if (param.full)
{
strCat(result, "(\\_");
strCatZ(result, "(\\_");
}
// Else diff/incr is required
else
{
strCat(result, "\\_");
strCatZ(result, "\\_");
}
// Append date/time regexp for diff/incr
strCat(result, DATE_TIME_REGEX);
strCatZ(result, DATE_TIME_REGEX);
// Filter on both diff/incr
if (param.differential && param.incremental)
{
strCat(result, "(D|I)");
strCatZ(result, "(D|I)");
}
// Else just diff
else if (param.differential)
@@ -74,13 +74,13 @@ backupRegExp(BackupRegExpParam param)
// If full requested then diff/incr is optional
if (param.full)
{
strCat(result, "){0,1}");
strCatZ(result, "){0,1}");
}
}
// Append the end anchor
if (!param.noAnchorEnd)
strCat(result, "$");
strCatZ(result, "$");
FUNCTION_LOG_RETURN(STRING, result);
}
+3 -3
View File
@@ -73,7 +73,7 @@ cmdBegin(bool logOption)
if (strchr(strPtr(commandParam), ' ') != NULL)
commandParam = strNewFmt("\"%s\"", strPtr(commandParam));
strCat(info, strPtr(commandParam));
strCat(info, commandParam);
}
strCatFmt(info, "]");
@@ -203,13 +203,13 @@ cmdEnd(int code, const String *errorMessage)
if (errorMessage == NULL)
{
strCat(info, "completed successfully");
strCatZ(info, "completed successfully");
if (cfgOptionValid(cfgOptLogTimestamp) && cfgOptionBool(cfgOptLogTimestamp))
strCatFmt(info, " (%" PRIu64 "ms)", timeMSec() - timeBegin);
}
else
strCat(info, strPtr(errorMessage));
strCat(info, errorMessage);
LOG(cfgLogLevelDefault(), 0, strPtr(info));
}
+10 -10
View File
@@ -45,7 +45,7 @@ helpRenderText(const String *text, size_t indent, bool indentFirst, size_t lengt
{
// Add LF if there is already content
if (strSize(result) != 0)
strCat(result, "\n");
strCat(result, LF_STR);
// Split the paragraph into lines that don't exceed the line length
StringList *partList = strLstNewSplitSizeZ(strLstGet(lineList, lineIdx), " ", length - indent);
@@ -56,14 +56,14 @@ helpRenderText(const String *text, size_t indent, bool indentFirst, size_t lengt
if (partIdx != 0 || indentFirst)
{
if (partIdx != 0)
strCat(result, "\n");
strCat(result, LF_STR);
if (strSize(strLstGet(partList, partIdx)))
strCatFmt(result, "%*s", (int)indent, "");
}
// Add the line
strCat(result, strPtr(strLstGet(partList, partIdx)));
strCat(result, strLstGet(partList, partIdx));
}
}
@@ -101,7 +101,7 @@ helpRenderValue(const Variant *value)
for (unsigned int keyIdx = 0; keyIdx < varLstSize(keyList); keyIdx++)
{
if (keyIdx != 0)
strCat(resultTemp, ", ");
strCatZ(resultTemp, ", ");
strCatFmt(
resultTemp, "%s=%s", strPtr(varStr(varLstGet(keyList, keyIdx))),
@@ -119,7 +119,7 @@ helpRenderValue(const Variant *value)
for (unsigned int listIdx = 0; listIdx < varLstSize(list); listIdx++)
{
if (listIdx != 0)
strCat(resultTemp, ", ");
strCatZ(resultTemp, ", ");
strCatFmt(resultTemp, "%s", strPtr(varStr(varLstGet(list, listIdx))));
}
@@ -151,7 +151,7 @@ helpRender(void)
// Display general help
if (cfgCommand() == cfgCmdHelp || cfgCommand() == cfgCmdNone)
{
strCat(
strCatZ(
result,
" - General help\n"
"\n"
@@ -271,7 +271,7 @@ helpRender(void)
if (value != NULL || defaultValue != NULL)
{
strCat(summary, " [");
strCatZ(summary, " [");
if (value != NULL)
strCatFmt(summary, "current=%s", cfgDefOptionSecure(optionDefId) ? "<redacted>" : strPtr(value));
@@ -279,12 +279,12 @@ helpRender(void)
if (defaultValue != NULL)
{
if (value != NULL)
strCat(summary, ", ");
strCatZ(summary, ", ");
strCatFmt(summary, "default=%s", strPtr(defaultValue));
}
strCat(summary, "]");
strCatZ(summary, "]");
}
// Output option help
@@ -341,7 +341,7 @@ helpRender(void)
if (value != NULL || defaultValue != NULL)
{
strCat(result, "\n");
strCat(result, LF_STR);
if (value != NULL)
strCatFmt(result, "current: %s\n", cfgDefOptionSecure(optionDefId) ? "<redacted>" : strPtr(value));
+18 -17
View File
@@ -549,7 +549,7 @@ formatTextDb(const KeyValue *stanzaInfo, String *resultStr, const String *backup
// List is ordered so 0 is always the current DB index
if (dbIdx == varLstSize(dbSection) - 1)
strCat(resultStr, "\n db (current)");
strCatZ(resultStr, "\n db (current)");
// Get the min/max archive information for the database
String *archiveResult = strNew("");
@@ -574,7 +574,7 @@ formatTextDb(const KeyValue *stanzaInfo, String *resultStr, const String *backup
strPtr(varStr(kvGet(archiveInfo, ARCHIVE_KEY_MAX_VAR))));
}
else
strCat(archiveResult, "none present\n");
strCatZ(archiveResult, "none present\n");
}
}
@@ -610,7 +610,7 @@ formatTextDb(const KeyValue *stanzaInfo, String *resultStr, const String *backup
strCatFmt(
backupResult, " timestamp start/stop: %s / %s\n", timeBufferStart, timeBufferStop);
strCat(backupResult, " wal start/stop: ");
strCatZ(backupResult, " wal start/stop: ");
KeyValue *archiveBackupInfo = varKv(kvGet(backupInfo, KEY_ARCHIVE_VAR));
@@ -621,7 +621,7 @@ formatTextDb(const KeyValue *stanzaInfo, String *resultStr, const String *backup
strPtr(varStr(kvGet(archiveBackupInfo, KEY_STOP_VAR))));
}
else
strCat(backupResult, "n/a\n");
strCatZ(backupResult, "n/a\n");
KeyValue *info = varKv(kvGet(backupInfo, BACKUP_KEY_INFO_VAR));
@@ -646,10 +646,10 @@ formatTextDb(const KeyValue *stanzaInfo, String *resultStr, const String *backup
if (kvGet(backupInfo, BACKUP_KEY_DATABASE_REF_VAR) != NULL)
{
VariantList *dbSection = kvGetList(backupInfo, BACKUP_KEY_DATABASE_REF_VAR);
strCat(backupResult, " database list:");
strCatZ(backupResult, " database list:");
if (varLstSize(dbSection) == 0)
strCat(backupResult, " none\n");
strCatZ(backupResult, " none\n");
else
{
for (unsigned int dbIdx = 0; dbIdx < varLstSize(dbSection); dbIdx++)
@@ -660,16 +660,17 @@ formatTextDb(const KeyValue *stanzaInfo, String *resultStr, const String *backup
strPtr(varStrForce(kvGet(db, KEY_OID_VAR))));
if (dbIdx != varLstSize(dbSection) - 1)
strCat(backupResult, ",");
strCatZ(backupResult, ",");
}
strCat(backupResult, "\n");
strCat(backupResult, LF_STR);
}
}
if (kvGet(backupInfo, BACKUP_KEY_LINK_VAR) != NULL)
{
VariantList *linkSection = kvGetList(backupInfo, BACKUP_KEY_LINK_VAR);
strCat(backupResult, " symlinks:\n");
strCatZ(backupResult, " symlinks:\n");
for (unsigned int linkIdx = 0; linkIdx < varLstSize(linkSection); linkIdx++)
{
@@ -680,16 +681,16 @@ formatTextDb(const KeyValue *stanzaInfo, String *resultStr, const String *backup
strPtr(varStr(kvGet(link, KEY_DESTINATION_VAR))));
if (linkIdx != varLstSize(linkSection) - 1)
strCat(backupResult, "\n");
strCat(backupResult, LF_STR);
}
strCat(backupResult, "\n");
strCat(backupResult, LF_STR);
}
if (kvGet(backupInfo, BACKUP_KEY_TABLESPACE_VAR) != NULL)
{
VariantList *tablespaceSection = kvGetList(backupInfo, BACKUP_KEY_TABLESPACE_VAR);
strCat(backupResult, " tablespaces:\n");
strCatZ(backupResult, " tablespaces:\n");
for (unsigned int tblIdx = 0; tblIdx < varLstSize(tablespaceSection); tblIdx++)
{
@@ -701,10 +702,10 @@ formatTextDb(const KeyValue *stanzaInfo, String *resultStr, const String *backup
strPtr(varStr(kvGet(tablespace, KEY_DESTINATION_VAR))));
if (tblIdx != varLstSize(tablespaceSection) - 1)
strCat(backupResult, "\n");
strCat(backupResult, LF_STR);
}
strCat(backupResult, "\n");
strCat(backupResult, LF_STR);
}
}
}
@@ -713,13 +714,13 @@ formatTextDb(const KeyValue *stanzaInfo, String *resultStr, const String *backup
if (strSize(archiveResult) > 0 || strSize(backupResult) > 0)
{
if (dbIdx != varLstSize(dbSection) - 1)
strCat(resultStr, "\n db (prior)");
strCatZ(resultStr, "\n db (prior)");
if (strSize(archiveResult) > 0)
strCat(resultStr, strPtr(archiveResult));
strCat(resultStr, archiveResult);
if (strSize(backupResult) > 0)
strCat(resultStr, strPtr(backupResult));
strCat(resultStr, backupResult);
}
}
FUNCTION_TEST_RETURN_VOID();
+9 -9
View File
@@ -1249,7 +1249,7 @@ restoreSelectiveExpression(Manifest *manifest)
if (expression == NULL)
expression = strNew("");
else
strCat(expression, "|");
strCatZ(expression, "|");
// Filter files in base directory
strCatFmt(expression, "(^" MANIFEST_TARGET_PGDATA "/" PG_PATH_BASE "/%s/)", strPtr(db));
@@ -1535,21 +1535,21 @@ restoreRecoveryWriteAutoConf(unsigned int pgVersion, const String *restoreLabel)
for (unsigned int contentIdx = 0; contentIdx < strLstSize(contentList); contentIdx++)
{
if (contentIdx != 0)
strCat(content, "\n");
strCat(content, LF_STR);
const String *line = strLstGet(contentList, contentIdx);
if (regExpMatch(recoveryExp, line))
strCatFmt(content, "# Removed by " PROJECT_NAME " restore on %s # ", strPtr(restoreLabel));
strCat(content, strPtr(line));
strCat(content, line);
}
// If settings will be appended then format the file so a blank line will be between old and new settings
if (!strEq(cfgOptionStr(cfgOptType), RECOVERY_TYPE_NONE_STR))
{
strTrim(content);
strCat(content, "\n\n");
strCatZ(content, "\n\n");
}
}
@@ -1837,7 +1837,7 @@ restoreJobResult(const Manifest *manifest, ProtocolParallelJob *job, RegExp *zer
// Note if file was zeroed (i.e. selective restore)
if (zeroed)
strCat(log, " zeroed");
strCatZ(log, " zeroed");
// Add filename
strCatFmt(log, " file %s", strPtr(restoreFilePgPath(manifest, file->name)));
@@ -1845,7 +1845,7 @@ restoreJobResult(const Manifest *manifest, ProtocolParallelJob *job, RegExp *zer
// If not copied and not zeroed add details to explain why it was not copied
if (!copy && !zeroed)
{
strCat(log, " - ");
strCatZ(log, " - ");
// On force we match on size and modification time
if (cfgOptionBool(cfgOptForce))
@@ -1857,16 +1857,16 @@ restoreJobResult(const Manifest *manifest, ProtocolParallelJob *job, RegExp *zer
// Else a checksum delta or file is zero-length
else
{
strCat(log, "exists and ");
strCatZ(log, "exists and ");
// No need to copy zero-length files
if (file->size == 0)
{
strCat(log, "is zero size");
strCatZ(log, "is zero size");
}
// The file matched the manifest checksum so did not need to be copied
else
strCat(log, "matches backup");
strCatZ(log, "matches backup");
}
}
+1 -1
View File
@@ -281,7 +281,7 @@ compressExtCat(String *file, CompressType type)
ASSERT(file != NULL);
strCat(file, strPtr(compressExtStr(type)));
strCat(file, compressExtStr(type));
FUNCTION_TEST_RETURN_VOID();
}
+1 -1
View File
@@ -142,7 +142,7 @@ exitSafe(int result, bool error, SignalType signalType)
// Terminate from a child
if (signalType == signalTypeNone)
strCat(errorMessage, "from child process");
strCatZ(errorMessage, "from child process");
// Else terminated directly
else
strCatFmt(errorMessage, "[SIG%s]", exitSignalName(signalType));
+4 -4
View File
@@ -104,8 +104,8 @@ httpHeaderAdd(HttpHeader *this, const String *key, const String *value)
MEM_CONTEXT_TEMP_BEGIN()
{
String *valueAppend = strDup(varStr(valueVar));
strCat(valueAppend, ", ");
strCat(valueAppend, strPtr(value));
strCatZ(valueAppend, ", ");
strCatZ(valueAppend, strPtr(value));
kvPut(this->kv, keyVar, VARSTR(valueAppend));
}
@@ -193,7 +193,7 @@ httpHeaderToLog(const HttpHeader *this)
const String *key = strLstGet(keyList, keyIdx);
if (strSize(result) != 1)
strCat(result, ", ");
strCatZ(result, ", ");
if (httpHeaderRedact(this, key))
strCatFmt(result, "%s: <redacted>", strPtr(key));
@@ -201,7 +201,7 @@ httpHeaderToLog(const HttpHeader *this)
strCatFmt(result, "%s: '%s'", strPtr(key), strPtr(httpHeaderGet(this, key)));
}
strCat(result, "}");
strCatZ(result, "}");
return result;
}
+3 -3
View File
@@ -143,7 +143,7 @@ httpQueryRender(const HttpQuery *this)
for (unsigned int keyIdx = 0; keyIdx < strLstSize(keyList); keyIdx++)
{
if (strSize(result) != 0)
strCat(result, "&");
strCatZ(result, "&");
strCatFmt(
result, "%s=%s", strPtr(strLstGet(keyList, keyIdx)),
@@ -167,14 +167,14 @@ httpQueryToLog(const HttpQuery *this)
for (unsigned int keyIdx = 0; keyIdx < strLstSize(keyList); keyIdx++)
{
if (strSize(result) != 1)
strCat(result, ", ");
strCatZ(result, ", ");
strCatFmt(
result, "%s: '%s'", strPtr(strLstGet(keyList, keyIdx)),
strPtr(httpQueryGet(this, strLstGet(keyList, keyIdx))));
}
strCat(result, "}");
strCatZ(result, "}");
return result;
}
+1 -1
View File
@@ -466,7 +466,7 @@ bufToLog(const Buffer *this)
if (this->limitSet)
strCatFmt(result, "%zu}", this->limit);
else
strCat(result, "<off>}");
strCatZ(result, "<off>}");
return result;
}
+39 -39
View File
@@ -665,7 +665,7 @@ jsonFromStrInternal(String *json, const String *string)
// If string is null
if (string == NULL)
{
strCat(json, NULL_Z);
strCat(json, NULL_STR);
}
// Else escape and output string
else
@@ -701,43 +701,43 @@ jsonFromStrInternal(String *json, const String *string)
{
case '"':
{
strCat(json, "\\\"");
strCatZ(json, "\\\"");
break;
}
case '\\':
{
strCat(json, "\\\\");
strCatZ(json, "\\\\");
break;
}
case '\n':
{
strCat(json, "\\n");
strCatZ(json, "\\n");
break;
}
case '\r':
{
strCat(json, "\\r");
strCatZ(json, "\\r");
break;
}
case '\t':
{
strCat(json, "\\t");
strCatZ(json, "\\t");
break;
}
case '\b':
{
strCat(json, "\\b");
strCatZ(json, "\\b");
break;
}
case '\f':
{
strCat(json, "\\f");
strCatZ(json, "\\f");
break;
}
}
@@ -805,21 +805,21 @@ jsonFromKvInternal(const KeyValue *kv)
// If going to add another key, prepend a comma
if (keyIdx > 0)
strCat(result, ",");
strCatZ(result, ",");
// Keys are always strings in the output, so add starting quote and colon.
strCatFmt(result, "\"%s\":", strPtr(key));
// NULL value
if (value == NULL)
strCat(result, NULL_Z);
strCat(result, NULL_STR);
else
{
switch (varType(value))
{
case varTypeKeyValue:
{
strCat(result, strPtr(jsonFromKvInternal(kvDup(varKv(value)))));
strCat(result, jsonFromKvInternal(kvDup(varKv(value))));
break;
}
@@ -827,12 +827,12 @@ jsonFromKvInternal(const KeyValue *kv)
{
// If the array is empty, then do not add formatting, else process the array.
if (varVarLst(value) == NULL)
strCat(result, NULL_Z);
strCat(result, NULL_STR);
else if (varLstSize(varVarLst(value)) == 0)
strCat(result, "[]");
strCatZ(result, "[]");
else
{
strCat(result, "[");
strCatZ(result, "[");
for (unsigned int arrayIdx = 0; arrayIdx < varLstSize(varVarLst(value)); arrayIdx++)
{
@@ -840,12 +840,12 @@ jsonFromKvInternal(const KeyValue *kv)
// If going to add another element, add a comma
if (arrayIdx > 0)
strCat(result, ",");
strCatZ(result, ",");
// If array value is null
if (arrayValue == NULL)
{
strCat(result, NULL_Z);
strCat(result, NULL_STR);
}
// If the type is a string, add leading and trailing double quotes
else if (varType(arrayValue) == varTypeString)
@@ -854,18 +854,18 @@ jsonFromKvInternal(const KeyValue *kv)
}
else if (varType(arrayValue) == varTypeKeyValue)
{
strCat(result, strPtr(jsonFromKvInternal(kvDup(varKv(arrayValue)))));
strCat(result, jsonFromKvInternal(kvDup(varKv(arrayValue))));
}
else if (varType(arrayValue) == varTypeVariantList)
{
strCat(result, strPtr(jsonFromVar(arrayValue)));
strCat(result, jsonFromVar(arrayValue));
}
// Numeric, Boolean or other type
else
strCat(result, strPtr(varStrForce(arrayValue)));
strCat(result, varStrForce(arrayValue));
}
strCat(result, "]");
strCatZ(result, "]");
}
break;
@@ -880,14 +880,14 @@ jsonFromKvInternal(const KeyValue *kv)
default:
{
strCat(result, strPtr(varStrForce(value)));
strCat(result, varStrForce(value));
break;
}
}
}
}
result = strCat(result, "}");
result = strCatZ(result, "}");
}
MEM_CONTEXT_TEMP_END();
@@ -946,19 +946,19 @@ jsonFromVar(const Variant *var)
// If VariantList then process each item in the array. Currently the list must be KeyValue types.
if (var == NULL)
{
strCat(jsonStr, strPtr(NULL_STR));
strCat(jsonStr, NULL_STR);
}
else if (varType(var) == varTypeBool)
{
strCat(jsonStr, strPtr(jsonFromBool(varBool(var))));
strCat(jsonStr, jsonFromBool(varBool(var)));
}
else if (varType(var) == varTypeUInt)
{
strCat(jsonStr, strPtr(jsonFromUInt(varUInt(var))));
strCat(jsonStr, jsonFromUInt(varUInt(var)));
}
else if (varType(var) == varTypeUInt64)
{
strCat(jsonStr, strPtr(jsonFromUInt64(varUInt64(var))));
strCat(jsonStr, jsonFromUInt64(varUInt64(var)));
}
else if (varType(var) == varTypeString)
{
@@ -971,63 +971,63 @@ jsonFromVar(const Variant *var)
// If not an empty array
if (varLstSize(vl) > 0)
{
strCat(jsonStr, "[");
strCatZ(jsonStr, "[");
// Currently only KeyValue and String lists are supported
for (unsigned int vlIdx = 0; vlIdx < varLstSize(vl); vlIdx++)
{
// If going to add another key, append a comma
if (vlIdx > 0)
strCat(jsonStr, ",");
strCatZ(jsonStr, ",");
Variant *varSub = varLstGet(vl, vlIdx);
if (varSub == NULL)
{
strCat(jsonStr, NULL_Z);
strCat(jsonStr, NULL_STR);
}
else if (varType(varSub) == varTypeBool)
{
strCat(jsonStr, strPtr(jsonFromBool(varBool(varSub))));
strCat(jsonStr, jsonFromBool(varBool(varSub)));
}
else if (varType(varSub) == varTypeKeyValue)
{
strCat(jsonStr, strPtr(jsonFromKvInternal(varKv(varSub))));
strCat(jsonStr, jsonFromKvInternal(varKv(varSub)));
}
else if (varType(varSub) == varTypeVariantList)
{
strCat(jsonStr, strPtr(jsonFromVar(varSub)));
strCat(jsonStr, jsonFromVar(varSub));
}
else if (varType(varSub) == varTypeInt)
{
strCat(jsonStr, strPtr(jsonFromInt(varInt(varSub))));
strCat(jsonStr, jsonFromInt(varInt(varSub)));
}
else if (varType(varSub) == varTypeInt64)
{
strCat(jsonStr, strPtr(jsonFromInt64(varInt64(varSub))));
strCat(jsonStr, jsonFromInt64(varInt64(varSub)));
}
else if (varType(varSub) == varTypeUInt)
{
strCat(jsonStr, strPtr(jsonFromUInt(varUInt(varSub))));
strCat(jsonStr, jsonFromUInt(varUInt(varSub)));
}
else if (varType(varSub) == varTypeUInt64)
{
strCat(jsonStr, strPtr(jsonFromUInt64(varUInt64(varSub))));
strCat(jsonStr, jsonFromUInt64(varUInt64(varSub)));
}
else
jsonFromStrInternal(jsonStr, varStr(varSub));
}
// Close the array
strCat(jsonStr, "]");
strCatZ(jsonStr, "]");
}
// Else empty array
else
strCat(jsonStr, "[]");
strCatZ(jsonStr, "[]");
}
else if (varType(var) == varTypeKeyValue)
{
strCat(jsonStr, strPtr(jsonFromKvInternal(varKv(var))));
strCat(jsonStr, jsonFromKvInternal(varKv(var)));
}
else
THROW(JsonFormatError, "variant type is invalid");
+15 -1
View File
@@ -280,7 +280,21 @@ strResize(String *this, size_t requested)
/**********************************************************************************************************************************/
String *
strCat(String *this, const char *cat)
strCat(String *this, const String *cat)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(STRING, this);
FUNCTION_TEST_PARAM(STRING, cat);
FUNCTION_TEST_END();
ASSERT(this != NULL);
ASSERT(cat != NULL);
FUNCTION_TEST_RETURN(strCatZN(this, strPtr(cat), strSize(cat)));
}
String *
strCatZ(String *this, const char *cat)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(STRING, this);
+3 -2
View File
@@ -84,8 +84,9 @@ String *strBase(const String *this);
bool strBeginsWith(const String *this, const String *beginsWith);
bool strBeginsWithZ(const String *this, const char *beginsWith);
// Append a string
String *strCat(String *this, const char *cat);
// Append a string or zero-terminated string
String *strCat(String *this, const String *cat);
String *strCatZ(String *this, const char *cat);
// Append a character
String *strCatChr(String *this, char cat);
+2 -2
View File
@@ -440,10 +440,10 @@ strLstJoinQuote(const StringList *this, const char *separator, const char *quote
for (unsigned int listIdx = 0; listIdx < strLstSize(this); listIdx++)
{
if (listIdx != 0)
strCat(join, separator);
strCatZ(join, separator);
if (strLstGet(this, listIdx) == NULL)
strCat(join, "[NULL]");
strCatZ(join, "[NULL]");
else
strCatFmt(join, "%s%s%s", quote, strPtr(strLstGet(this, listIdx)), quote);
}
+1 -1
View File
@@ -302,7 +302,7 @@ cfgLoadLogFile(void)
strCatFmt(logFile, "-%03u", cfgOptionUInt(cfgOptProcess));
// Add extension
strCat(logFile, ".log");
strCatZ(logFile, ".log");
// Attempt to open log file
if (!logFileSet(strPtr(logFile)))
+2 -2
View File
@@ -273,8 +273,8 @@ cfgFileLoadPart(String **config, const Buffer *configPart)
else
// Add the config part to the result config file
strCat(*config, "\n");
strCat(*config, strPtr(configPartStr));
strCat(*config, LF_STR);
strCat(*config, configPartStr);
}
}
+2 -2
View File
@@ -360,7 +360,7 @@ dbBackupStopQuery(unsigned int pgVersion)
// For PostgreSQL >= 9.6 the backup label and tablespace map are returned from pg_stop_backup
if (pgVersion >= PG_VERSION_96)
{
strCat(
strCatZ(
result,
",\n"
" labelfile::text as backuplabel_file,\n"
@@ -368,7 +368,7 @@ dbBackupStopQuery(unsigned int pgVersion)
}
// Build stop backup function
strCat(
strCatZ(
result,
"\n"
" from pg_catalog.pg_stop_backup(");
+2 -2
View File
@@ -2866,9 +2866,9 @@ manifestTargetPath(const Manifest *this, const ManifestTarget *target)
String *pgPath = strPath(manifestPathPg(target->name));
if (strSize(pgPath) != 0)
strCat(pgPath, "/");
strCatZ(pgPath, "/");
strCat(pgPath, strPtr(target->path));
strCat(pgPath, target->path);
MEM_CONTEXT_PRIOR_BEGIN()
{
+2 -2
View File
@@ -168,8 +168,8 @@ protocolClientProcessError(ProtocolClient *this, KeyValue *errorKv)
{
const String *stack = varStr(kvGet(errorKv, VARSTR(PROTOCOL_ERROR_STACK_STR)));
strCat(throwMessage, "\n");
strCat(throwMessage, stack == NULL ? "no stack trace available" : strPtr(stack));
strCat(throwMessage, LF_STR);
strCat(throwMessage, stack == NULL ? STRDEF("no stack trace available") : stack);
}
THROWP(type, strPtr(throwMessage));
+3 -3
View File
@@ -333,7 +333,7 @@ storageS3Request(
strPtr(httpClientResponseMessage(httpClient)));
// Output uri/query
strCat(error, "\n*** URI/Query ***:");
strCatZ(error, "\n*** URI/Query ***:");
strCatFmt(error, "\n%s", strPtr(httpUriEncode(uri, true)));
@@ -343,7 +343,7 @@ storageS3Request(
// Output request headers
const StringList *requestHeaderList = httpHeaderList(requestHeader);
strCat(error, "\n*** Request Headers ***:");
strCatZ(error, "\n*** Request Headers ***:");
for (unsigned int requestHeaderIdx = 0; requestHeaderIdx < strLstSize(requestHeaderList); requestHeaderIdx++)
{
@@ -361,7 +361,7 @@ storageS3Request(
if (strLstSize(responseHeaderList) > 0)
{
strCat(error, "\n*** Response Headers ***:");
strCatZ(error, "\n*** Response Headers ***:");
for (unsigned int responseHeaderIdx = 0; responseHeaderIdx < strLstSize(responseHeaderList);
responseHeaderIdx++)