1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-18 23:57:33 +02:00

Add macros to create constant Buffer objects.

These are more efficient than creating buffers in place when needed.

After replacement discovered that bufNewStr() and BufNewZ() were not being used in the core code so removed them.  This required using the macros in tests which is not the usual pattern.
This commit is contained in:
David Steele
2019-04-20 08:16:17 -04:00
parent c9168028c6
commit e513c52c09
27 changed files with 236 additions and 224 deletions

View File

@ -557,7 +557,7 @@ testRun(void)
"{\"name\":\"pgBackRest\",\"service\":\"error\",\"version\":\"" PROJECT_VERSION "\"}\n"
"{}\n");
IoRead *read = ioBufferReadIo(ioBufferReadNew(bufNewStr(protocolString)));
IoRead *read = ioBufferReadIo(ioBufferReadNew(BUFSTR(protocolString)));
ioReadOpen(read);
IoWrite *write = ioBufferWriteIo(ioBufferWriteNew(bufNew(1024)));
ioWriteOpen(write);
@ -673,11 +673,10 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
storagePut(
storageNewWriteNP(storageTest, strNew("pgbackrest.conf")),
bufNewStr(
strNew(
"[global]\n"
"repo1-cipher-type=aes-256-cbc\n"
"repo1-cipher-pass=acbd\n")));
BUFSTRDEF(
"[global]\n"
"repo1-cipher-type=aes-256-cbc\n"
"repo1-cipher-pass=acbd\n"));
argList = strLstNew();
strLstAddZ(argList, "/usr/bin/pgbackrest");
@ -704,11 +703,10 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
storagePut(
storageNewWriteNP(storageTest, strNew("pgbackrest.conf")),
bufNewStr(
strNew(
"[global]\n"
"repo1-cipher-type=aes-256-cbc\n"
"repo1-cipher-pass=dcba\n")));
BUFSTRDEF(
"[global]\n"
"repo1-cipher-type=aes-256-cbc\n"
"repo1-cipher-pass=dcba\n"));
argList = strLstNew();
strLstAddZ(argList, "/usr/bin/pgbackrest");