Slightly optimize svn_stringbuf_from_stream() to avoid allocating twice
more memory and unnecessary memcpy() when LEN_HINT is equal to final stringbuf
length.
* subversion/libsvn_subr/stream.c
(svn_stringbuf_from_stream): Always preallocate LEN_HINT + MIN_READ_SIZE
bytes to be able perform final read without stringbuf reallocation.
git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1707196 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/subversion/libsvn_subr/stream.c b/subversion/libsvn_subr/stream.c
index 5bad1d5..efcabe3 100644
--- a/subversion/libsvn_subr/stream.c
+++ b/subversion/libsvn_subr/stream.c
@@ -1490,7 +1490,7 @@
apr_size_t to_read = 0;
svn_stringbuf_t *text
- = svn_stringbuf_create_ensure(len_hint ? len_hint : MIN_READ_SIZE,
+ = svn_stringbuf_create_ensure(len_hint + MIN_READ_SIZE,
result_pool);
do