You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-05 00:28:52 +02:00
Rename strNew() to strNewZ() and add parameter-less strNew().
Replace all instances of strNew("") with strNew() and use strNewZ() for non-empty zero-terminated strings. Besides saving a useless parameter, this will allow smarter memory allocation in a future commit by signaling intent, in general, to append or not. In the tests use STRDEF() or VARSTRDEF() where more appropriate rather than blindly replacing with strNewZ(). Also replace strLstAdd() with strLstAddZ() where appropriate for the same reason.
This commit is contained in:
@ -68,17 +68,17 @@ testRun(void)
|
||||
if (testBegin("helpRenderText()"))
|
||||
{
|
||||
TEST_RESULT_STR_Z(
|
||||
helpRenderText(strNew("this is a short sentence"), false, 0, false, 80), "this is a short sentence", "one line");
|
||||
helpRenderText(STRDEF("this is a short sentence"), false, 0, false, 80), "this is a short sentence", "one line");
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
helpRenderText(strNew("this is a short sentence"), false, 4, false, 14),
|
||||
helpRenderText(STRDEF("this is a short sentence"), false, 4, false, 14),
|
||||
"this is a\n"
|
||||
" short\n"
|
||||
" sentence",
|
||||
"three lines, no indent first");
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
helpRenderText(strNew("This is a short paragraph.\n\nHere is another one."), true, 2, true, 16),
|
||||
helpRenderText(STRDEF("This is a short paragraph.\n\nHere is another one."), true, 2, true, 16),
|
||||
" This is a\n"
|
||||
" short\n"
|
||||
" paragraph.\n"
|
||||
@ -506,7 +506,7 @@ testRun(void)
|
||||
// Restore normal stdout
|
||||
dup2(stdoutSave, STDOUT_FILENO);
|
||||
|
||||
Storage *storage = storagePosixNewP(strNew(testPath()));
|
||||
Storage *storage = storagePosixNewP(strNewZ(testPath()));
|
||||
TEST_RESULT_STR_Z(strNewBuf(storageGetP(storageNewReadP(storage, stdoutFile))), generalHelp, " check text");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user