commit adc19d556533254f7f3fe8101c25f9de1ca46331 from: Stefan Sperling date: Sun Jul 28 10:48:56 2019 UTC remove pointless output parameter from got_pathlist_append() commit - 073e575f1b7f693fbff2009dc41b5f79d0a71d56 commit + adc19d556533254f7f3fe8101c25f9de1ca46331 blob - 41f97f73c98b213f120d4ad393a9b1a6316bec7a blob + dc2cda4ba6b716c5e52b8ec10832a3d71942076e --- 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; blob - 56a58656792331a503dc2c9ac8dde91ea15d3a5a blob + 34114a210f4a19103a09e908e8a037fb1ba73374 --- 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 *); blob - 66561a03e3bf9733f886c889f517c0d9f2dab98f blob + a4c1a16f65eda672d07082db8de443723702caa4 --- 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; } blob - dc88ba86ed50b00aa2bcbd9463195e873ac1a0af blob + 3df09c5d054b2011eb32474bd2a2f373638965ed --- 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,