diff options
| author | Edward Thomson <ethomson@microsoft.com> | 2015-02-10 23:55:07 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-02-12 22:54:47 -0500 |
| commit | 4aa664ae3953d99c2ae4cd769f02818bc122eebc (patch) | |
| tree | 7316e3d7febcbcde19dd4844af9503f4c6d57d69 /src/zstream.c | |
| parent | 3603cb0978b7ef21ff9cd63693ebd6d27bc2bc53 (diff) | |
| download | libgit2-4aa664ae3953d99c2ae4cd769f02818bc122eebc.tar.gz | |
git_buf_grow_by: increase buf asize incrementally
Introduce `git_buf_grow_by` to incrementally increase the size of a
`git_buf`, performing an overflow calculation on the growth.
Diffstat (limited to 'src/zstream.c')
| -rw-r--r-- | src/zstream.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/zstream.c b/src/zstream.c index 06660e981..2130bc3ca 100644 --- a/src/zstream.c +++ b/src/zstream.c @@ -134,8 +134,7 @@ int git_zstream_deflatebuf(git_buf *out, const void *in, size_t in_len) while (!git_zstream_done(&zs)) { size_t step = git_zstream_suggest_output_len(&zs), written; - GITERR_CHECK_ALLOC_ADD(out->size, step); - if ((error = git_buf_grow(out, out->size + step)) < 0) + if ((error = git_buf_grow_by(out, step)) < 0) goto done; written = out->asize - out->size; |
