Commit Diff
--- got/got.c +++ got/got.c @@ -955,7 +955,7 @@ cmd_checkout(int argc, char *argv[]) goto done; } - error = got_pathlist_append(NULL, &paths, "", NULL); + error = got_pathlist_append(&paths, "", NULL); if (error) goto done; error = got_worktree_checkout_files(worktree, &paths, repo, @@ -1074,14 +1074,14 @@ get_worktree_paths_from_argv(struct got_pathlist_head path = strdup(""); if (path == NULL) return got_error_from_errno("strdup"); - return got_pathlist_append(NULL, paths, path, NULL); + return got_pathlist_append(paths, path, NULL); } for (i = 0; i < argc; i++) { err = got_worktree_resolve_path(&path, worktree, argv[i]); if (err) break; - err = got_pathlist_append(NULL, paths, path, NULL); + err = got_pathlist_append(paths, path, NULL); if (err) { free(path); break; @@ -1862,7 +1862,7 @@ cmd_diff(int argc, char *argv[]) arg.id_str = id_str; arg.header_shown = 0; - error = got_pathlist_append(NULL, &paths, path, NULL); + error = got_pathlist_append(&paths, path, NULL); if (error) goto done; --- include/got_path.h +++ include/got_path.h @@ -83,11 +83,9 @@ const struct got_error *got_pathlist_insert(struct got * The caller should already have initialized the list head. This list stores * the pointer to the path as-is, i.e. the path is not copied internally and * must remain available until the list is freed with got_pathlist_free(). - * If the first argument is not NULL, set it to a pointer to the newly inserted - * element, or to a NULL pointer in case the path was already on the list. */ -const struct got_error *got_pathlist_append(struct got_pathlist_entry **, - struct got_pathlist_head *, const char *, void *); +const struct got_error *got_pathlist_append(struct got_pathlist_head *, + const char *, void *); /* Free resources allocated for a path list. */ void got_pathlist_free(struct got_pathlist_head *); --- lib/path.c +++ lib/path.c @@ -254,8 +254,8 @@ got_pathlist_insert(struct got_pathlist_entry **insert } const struct got_error * -got_pathlist_append(struct got_pathlist_entry **pe, - struct got_pathlist_head *pathlist, const char *path, void *data) +got_pathlist_append(struct got_pathlist_head *pathlist, + const char *path, void *data) { struct got_pathlist_entry *new; @@ -265,8 +265,6 @@ got_pathlist_append(struct got_pathlist_entry **pe, new->path = path; new->data = data; TAILQ_INSERT_TAIL(pathlist, new, entry); - if (pe) - *pe = new; return NULL; } --- regress/worktree/worktree_test.c +++ regress/worktree/worktree_test.c @@ -378,7 +378,7 @@ worktree_checkout(const char *repo_path) if (err != NULL) goto done; - err = got_pathlist_append(NULL, &paths, "", NULL); + err = got_pathlist_append(&paths, "", NULL); if (err) goto done; err = got_worktree_checkout_files(worktree, &paths, repo, progress_cb,