summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-08-01 04:32:36 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-08-19 07:38:34 (GMT)
commit3149007475f8c38ee66b448af9c55fc102534c46 (patch)
treeb3f064af5d310897a2fe89f47c9bfcf19810500a /fast-import.c
parentea08a6fd194991f9d800e4cac5ae55fdb02dd235 (diff)
downloadgit-3149007475f8c38ee66b448af9c55fc102534c46.zip
git-3149007475f8c38ee66b448af9c55fc102534c46.tar.gz
git-3149007475f8c38ee66b448af9c55fc102534c46.tar.bz2
Use handy ALLOC_GROW macro in fast-import when possible
Instead of growing our buffer by hand during the inline variant of cmd_data() we can save a few lines of code and just use the nifty new ALLOC_GROW macro already available to us. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/fast-import.c b/fast-import.c
index 7e136a6..d7fa2b7 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1487,12 +1487,7 @@ static void *cmd_data (size_t *size)
if (term_len == command_buf.len
&& !strcmp(term, command_buf.buf))
break;
- if (sz < (length + command_buf.len)) {
- sz = sz * 3 / 2 + 16;
- if (sz < (length + command_buf.len))
- sz = length + command_buf.len;
- buffer = xrealloc(buffer, sz);
- }
+ ALLOC_GROW(buffer, length + command_buf.len, sz);
memcpy(buffer + length,
command_buf.buf,
command_buf.len - 1);