]> git.ipfire.org Git - thirdparty/git.git/blobdiff - apply.c
builtin/show-index: set the algorithm for object IDs
[thirdparty/git.git] / apply.c
diff --git a/apply.c b/apply.c
index 668b16e9893d2f1e0501f2771716138db6e2efdd..466f880d737dbdbff8259e89ec9767643fb248e1 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -21,6 +21,7 @@
 #include "quote.h"
 #include "rerere.h"
 #include "apply.h"
+#include "entry.h"
 
 struct gitdiff_data {
        struct strbuf *root;
@@ -1781,7 +1782,7 @@ static int parse_single_patch(struct apply_state *state,
                struct fragment *fragment;
                int len;
 
-               fragment = xcalloc(1, sizeof(*fragment));
+               CALLOC_ARRAY(fragment, 1);
                fragment->linenr = state->linenr;
                len = parse_fragment(state, line, size, patch, fragment);
                if (len <= 0) {
@@ -1959,7 +1960,7 @@ static struct fragment *parse_binary_hunk(struct apply_state *state,
                size -= llen;
        }
 
-       frag = xcalloc(1, sizeof(*frag));
+       CALLOC_ARRAY(frag, 1);
        frag->patch = inflate_it(data, hunk_size, origlen);
        frag->free_patch = 1;
        if (!frag->patch)
@@ -4681,7 +4682,7 @@ static int apply_patch(struct apply_state *state,
                struct patch *patch;
                int nr;
 
-               patch = xcalloc(1, sizeof(*patch));
+               CALLOC_ARRAY(patch, 1);
                patch->inaccurate_eof = !!(options & APPLY_OPT_INACCURATE_EOF);
                patch->recount =  !!(options & APPLY_OPT_RECOUNT);
                nr = parse_chunk(state, buf.buf + offset, buf.len - offset, patch);