commit 8dc303ccb46a3b17a7276fb5597fed2a6eee2a1f from: Stefan Sperling date: Sat Jul 27 18:18:26 2019 UTC eliminate needless 'goto' in worktree_status() commit - a51a74b38b5e1f44f2967ff4e43e5a4485a13c7a commit + 8dc303ccb46a3b17a7276fb5597fed2a6eee2a1f blob - b40be459fb8d284670deee511cf74e3860060e99 blob + 59a5e820c09d0781286104cfdf959335e2b09099 --- lib/worktree.c +++ lib/worktree.c @@ -2319,10 +2319,9 @@ worktree_status(struct got_worktree *worktree, const c char *ondisk_path = NULL; if (asprintf(&ondisk_path, "%s%s%s", - worktree->root_path, path[0] ? "/" : "", path) == -1) { - err = got_error_from_errno("asprintf"); - goto done; - } + worktree->root_path, path[0] ? "/" : "", path) == -1) + return got_error_from_errno("asprintf"); + workdir = opendir(ondisk_path); if (workdir == NULL) { if (errno != ENOTDIR && errno != ENOENT) @@ -2346,7 +2345,7 @@ worktree_status(struct got_worktree *worktree, const c err = got_fileindex_diff_dir(fileindex, workdir, worktree->root_path, path, repo, &fdiff_cb, &arg); } -done: + if (workdir) closedir(workdir); free(ondisk_path);