1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-15 01:04:37 +02:00

Various Buffer improvements.

Add bufDup() and bufNewUsedC().

Arrange bufNewC() params to match bufNewUsedC() since they have always seemed backward.

Fix bufHex() to only render the used portion of the buffer and fix some places where used was not being set correctly.

Use a union to make macro assignments for all legal values without casting.  This is much more likely to catch bad assignments.
This commit is contained in:
David Steele
2019-05-02 12:43:09 -04:00
parent 59234f249e
commit 498017bcf0
10 changed files with 95 additions and 30 deletions

View File

@ -152,7 +152,7 @@ ioTestFilterMultiplyProcess(IoTestFilterMultiply *this, const Buffer *input, Buf
else
{
char flushZ[] = {this->flushChar, 0};
bufCat(output, bufNewC(1, flushZ));
bufCat(output, bufNewC(flushZ, 1));
this->flushTotal--;
}
}
@ -280,7 +280,7 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
ioBufferSizeSet(2);
buffer = bufNew(2);
bufferOriginal = bufNewC(3, "123");
bufferOriginal = bufNewC("123", 3);
MEM_CONTEXT_TEMP_BEGIN()
{