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

Add ioReadLineParam() to allow return on eof.

ioReadLine() errors on eof because it has previously been used only for protocol reads.

Returning on eof is handy for reading lines from files where eof is not considered an error.
This commit is contained in:
David Steele
2019-08-28 10:46:54 -04:00
parent a605117a23
commit d1675b7e91
3 changed files with 29 additions and 5 deletions

View File

@ -431,6 +431,11 @@ testRun(void)
ioReadOpen(read);
TEST_ERROR(ioReadLine(read), FileReadError, "unable to find line in 10 byte buffer");
// Read line without eof
read = ioBufferReadNew(BUFSTRDEF("1234"));
ioReadOpen(read);
TEST_RESULT_STR(strPtr(ioReadLineParam(read, true)), "1234", "read line without eof");
// Read IO into a buffer
// -------------------------------------------------------------------------------------------------------------------------
ioBufferSizeSet(8);