Note: one thing I noticed while preparing the fix is that our `readline_fn` functions for different streams have inconsistent behavior if the input data contains \0 bytes. More specifically, they may return different `line` values, that may either be truncated at \0 or actually contain the whole data between EOLs, including \0 bytes. For now, this patch only fixes the excessive memory usage problem, and I noted this related problem in the test and left it for future work.
* subversion/libsvn_subr/stream.c (readline_apr_lf, readline_apr_generic): Reallocate the buffer based on its current size, instead of calculating the new size based on the already prealloc'd size. There are no actual benefits in reallocating based on `blocksize`, and in the described case with \0 bytes doing so also backfires and may cause excessive allocations due to the actual size of the string being less than we expect it to. A degenerate case of the erroneous behavior is ...
* subversion/tests/libsvn_subr/stream-test.c (test_stream_readline_file_nul): ...exploited in this new test. (test_funcs): Run new test.
* subversion/libsvn_subr/stream.c (readline_apr_lf): New. (readline_apr_generic): New, factored out from ... (readline_apr_handler): ...here. Call the apr_file_gets()-based routine when we're looking for an LF end-of-line sequence to avoid unnecessary syscalls.
* subversion/tests/libsvn_subr/stream-test.c (test_stream_readline_file): New helper for ... (test_stream_readline_file_lf, test_stream_readline_file_crlf): ...these new tests that cover svn_stream_readline() behavior for LF and CRLF terminated lines. (test_funcs): Add new tests.