diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2008-10-25 15:30:22 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-10-25 12:08:11 -0700 |
commit | 7c4ed8c83583517e7e6d851c8c01996ca6c803ff (patch) | |
tree | 03031bef60bd4ac7a40f52692bcf5df6f7ff115a /builtin-blame.c | |
parent | 5c283eb13c94be6ca974aa722159dc9838d10d97 (diff) | |
download | git-7c4ed8c83583517e7e6d851c8c01996ca6c803ff.tar.gz |
blame: inline get_patch()
Inline get_patch() to its only call site as a preparation for getting rid
of struct patch. Also we don't need to check the ptr members because
fill_origin_blob() already did, and the caller didn't check for NULL
anyway, so drop the test.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-blame.c')
-rw-r--r-- | builtin-blame.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/builtin-blame.c b/builtin-blame.c index 48cc0c175d..593b539f1e 100644 --- a/builtin-blame.c +++ b/builtin-blame.c @@ -542,25 +542,6 @@ static struct patch *compare_buffer(mmfile_t *file_p, mmfile_t *file_o, return state.ret; } -/* - * Run diff between two origins and grab the patch output, so that - * we can pass blame for lines origin is currently suspected for - * to its parent. - */ -static struct patch *get_patch(struct origin *parent, struct origin *origin) -{ - mmfile_t file_p, file_o; - struct patch *patch; - - fill_origin_blob(parent, &file_p); - fill_origin_blob(origin, &file_o); - if (!file_p.ptr || !file_o.ptr) - return NULL; - patch = compare_buffer(&file_p, &file_o, 0); - num_get_patch++; - return patch; -} - static void free_patch(struct patch *p) { free(p->chunks); @@ -824,12 +805,22 @@ static int pass_blame_to_parent(struct scoreboard *sb, { int i, last_in_target, plno, tlno; struct patch *patch; + mmfile_t file_p, file_o; last_in_target = find_last_in_target(sb, target); if (last_in_target < 0) return 1; /* nothing remains for this target */ - patch = get_patch(parent, target); + /* + * Run diff between two origins and grab the patch output, so that + * we can pass blame for lines origin is currently suspected for + * to its parent. + */ + fill_origin_blob(parent, &file_p); + fill_origin_blob(target, &file_o); + patch = compare_buffer(&file_p, &file_o, 0); + num_get_patch++; + plno = tlno = 0; for (i = 0; i < patch->num; i++) { struct chunk *chunk = &patch->chunks[i]; |