Commit 8dc303ccb46a3b17a7276fb5597fed2a6eee2a1f

Stefan Sperling 2019-07-27T17:40:39

eliminate needless 'goto' in worktree_status()

diff --git a/lib/worktree.c b/lib/worktree.c
index b40be45..59a5e82 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -2319,10 +2319,9 @@ worktree_status(struct got_worktree *worktree, const char *path,
 	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 char *path,
 		err = got_fileindex_diff_dir(fileindex, workdir,
 		    worktree->root_path, path, repo, &fdiff_cb, &arg);
 	}
-done:
+
 	if (workdir)
 		closedir(workdir);
 	free(ondisk_path);