threads / patch / 8351

patchdiff-delta: use realloc instead of xrealloc

Subject: [PATCH] diff-delta: use realloc instead of xrealloc

## tl;dr

4 messages between May 29, 2007 and May 30, 2007. Diffs are folded; open one to read it.

replies: 3people: 3as markdown or json

Martin Koegler· May 29, 2007, 19:08 UTC · lore

Commit 83572c1a914d3f7a8dd66d954c11bbc665b7b923 changed many realloc to xrealloc. This change was made in diff-delta.c too, although the code can handle an out of memory failure.

This patch reverts this change in diff-delta.c.
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
 diff-delta.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to diff-delta.c +1 −1
diff --git a/diff-delta.c b/diff-delta.c
index 17757d2..faf96e4 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -388,7 +388,7 @@ create_delta(const struct delta_index *index,
 				outsize = max_size + MAX_OP_SIZE + 1;
 			if (max_size && outpos > max_size)
 				break;
-			out = xrealloc(out, outsize);
+			out = realloc(out, outsize);
 			if (!out) {
 				free(tmp);
 				return NULL;
-- 
1.5.2.846.g9a144
Junio C Hamano· May 29, 2007, 23:51 UTC · re: Martin Koegler · lore

Re: [PATCH] diff-delta: use realloc instead of xrealloc

Martin Koegler <mkoegler@auto.tuwien.ac.at> writes:
Show 5 quoted lines
> Commit 83572c1a914d3f7a8dd66d954c11bbc665b7b923 changed many
> realloc to xrealloc. This change was made in diff-delta.c too,
> although the code can handle an out of memory failure.
>
> This patch reverts this change in diff-delta.c.

Wasn't there a discussion around this exact issue when the original patch was applied?

Nicolas Pitre· May 30, 2007, 02:57 UTC · re: Junio C Hamano · lore

Re: [PATCH] diff-delta: use realloc instead of xrealloc

On Tue, 29 May 2007, Junio C Hamano wrote:
Show 10 quoted lines
> Martin Koegler <mkoegler@auto.tuwien.ac.at> writes:
> 
> > Commit 83572c1a914d3f7a8dd66d954c11bbc665b7b923 changed many
> > realloc to xrealloc. This change was made in diff-delta.c too,
> > although the code can handle an out of memory failure.
> >
> > This patch reverts this change in diff-delta.c.
> 
> Wasn't there a discussion around this exact issue when the
> original patch was applied?
Maybe, but I cannot remember it, not can I justify that xrealloc now.
Nicolas
Junio C Hamano· May 30, 2007, 06:17 UTC · re: Nicolas Pitre · lore

Re: [PATCH] diff-delta: use realloc instead of xrealloc

Nicolas Pitre <nico@cam.org> writes:
Show 6 quoted lines
> On Tue, 29 May 2007, Junio C Hamano wrote:
>
>> Wasn't there a discussion around this exact issue when the
>> original patch was applied?
>
> Maybe, but I cannot remember it, not can I justify that xrealloc now.
Actually, the discussion was older than the patch.
    http://thread.gmane.org/gmane.comp.version-control.git/43766/focus=43783

And I myself suggested to use non x- variant of allocation routines in diff-delta.c as the callers know how to handle near oom condition ;-).

← back to recent threads