stagit
static git repository generator
git clone https://9o.is/git/stagit.git
commit 70284d6708b2c799a052e90e2467ebb36467caea parent 5e7a1335f1ae24c870ed8f43bd6fee8e535a0885 Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Sat, 22 Apr 2017 19:07:07 +0200 improve commitinfo_getstats - reorder: unnecessary allocation when git_patch_from_diff fails. - no need to free patch object when git_patch_from_diff fails. Diffstat:
| M | stagit.c | | | 7 | ++----- |
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/stagit.c b/stagit.c @@ -110,13 +110,10 @@ commitinfo_getstats(struct commitinfo *ci) err(1, "calloc"); for (i = 0; i < ndeltas; i++) { + if (git_patch_from_diff(&patch, ci->diff, i)) + goto err; if (!(di = calloc(1, sizeof(struct deltainfo)))) err(1, "calloc"); - if (git_patch_from_diff(&patch, ci->diff, i)) { - git_patch_free(patch); - free(di); - goto err; - } di->patch = patch; ci->deltas[i] = di;