From 5ff6a8462f7461075fb39cd0d6d76e6c51ffbc9f Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 3 Mar 2021 15:14:38 +0900 Subject: Imported Upstream version 2.1.0 --- match-trees.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'match-trees.c') diff --git a/match-trees.c b/match-trees.c index e80b4af3..1ce0954a 100644 --- a/match-trees.c +++ b/match-trees.c @@ -140,17 +140,12 @@ static void match_trees(const unsigned char *hash1, goto next; score = score_trees(elem, hash2); if (*best_score < score) { - char *newpath; - newpath = xmalloc(strlen(base) + strlen(path) + 1); - sprintf(newpath, "%s%s", base, path); free(*best_match); - *best_match = newpath; + *best_match = xstrfmt("%s%s", base, path); *best_score = score; } if (recurse_limit) { - char *newbase; - newbase = xmalloc(strlen(base) + strlen(path) + 2); - sprintf(newbase, "%s%s/", base, path); + char *newbase = xstrfmt("%s%s/", base, path); match_trees(elem, hash2, best_score, best_match, newbase, recurse_limit - 1); free(newbase); -- cgit v1.2.3