From: Bruno Cesar Ribas <ribas@c3sl.ufpr.br>
To: git@vger.kernel.org
Subject: [PATCH] use xmalloc in diff-delta.c and removed NULL verification in builtin-pack-objects.c from create_delta_index()
Date: Tue, 27 Mar 2007 22:04:30 -0300 [thread overview]
Message-ID: <20070328010430.GA8783@c3sl.ufpr.br> (raw)
builtin-pack-objects.c | 2 --
diff-delta.c | 8 ++------
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index b5f9648..04a4abc 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1254,8 +1254,6 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
}
if (!src->index) {
src->index = create_delta_index(src->data, src_size);
- if (!src->index)
- die("out of memory");
}
delta_buf = create_delta(src->index, trg->data, trg_size, &delta_size, max_size);
diff --git a/diff-delta.c b/diff-delta.c
index 9f998d0..011d7d6 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -157,9 +157,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
memsize = sizeof(*index) +
sizeof(*hash) * hsize +
sizeof(*entry) * entries;
- mem = malloc(memsize);
- if (!mem)
- return NULL;
+ mem = xmalloc(memsize);
index = mem;
mem = index + 1;
hash = mem;
@@ -258,9 +256,7 @@ create_delta(const struct delta_index *index,
outsize = 8192;
if (max_size && outsize >= max_size)
outsize = max_size + MAX_OP_SIZE + 1;
- out = malloc(outsize);
- if (!out)
- return NULL;
+ out = xmalloc(outsize);
/* store reference buffer size */
i = index->src_size;
--
1.5.0.3
--
Bruno Ribas - ribas@c3sl.ufpr.br
http://web.inf.ufpr.br/ribas
C3SL: http://www.c3sl.ufpr.br
next reply other threads:[~2007-03-28 1:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-28 1:04 Bruno Cesar Ribas [this message]
2007-03-28 3:03 ` [PATCH] use xmalloc in diff-delta.c and removed NULL verification in builtin-pack-objects.c from create_delta_index() Bruno Cesar Ribas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070328010430.GA8783@c3sl.ufpr.br \
--to=ribas@c3sl.ufpr.br \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox