commit 8f6d9a6a62b3640c758a23e26cd567e2e44406e1 from: Stefan Sperling date: Tue Jan 08 20:48:28 2019 UTC mark got_pathset iteration functions as safe commit - 398789b2a47fcb448382e7d5f6c7e4b57f22d8ec commit + 8f6d9a6a62b3640c758a23e26cd567e2e44406e1 blob - 2eb549818d8d6c862e1ce24147a7c43c36d91754 blob + 098dd95cefae9823eb8553bd2a8d3730ea263d0c --- lib/got_lib_pathset.h +++ lib/got_lib_pathset.h @@ -25,10 +25,10 @@ void *got_pathset_get(struct got_pathset *, const char const struct got_error *got_pathset_remove(void **, struct got_pathset *, const char *); int got_pathset_contains(struct got_pathset *, const char *); -const struct got_error *got_pathset_for_each(struct got_pathset *, +const struct got_error *got_pathset_for_each_safe(struct got_pathset *, const struct got_error *(*cb)(const char *, void *, void *), void *); -const struct got_error *got_pathset_for_each_reverse(struct got_pathset *, +const struct got_error *got_pathset_for_each_reverse_safe(struct got_pathset *, const struct got_error *(*cb)(const char *, void *, void *), void *); int got_pathset_num_elements(struct got_pathset *); blob - 66676de9241d960fbd1fb6bdd78e7747f1f45750 blob + 828ea4b4b7a8de64669c944e61fe0a10251f64ae --- lib/pathset.c +++ lib/pathset.c @@ -185,7 +185,7 @@ got_pathset_contains(struct got_pathset *set, const ch } const struct got_error * -got_pathset_for_each(struct got_pathset *set, +got_pathset_for_each_safe(struct got_pathset *set, const struct got_error *(*cb)(const char *, void *, void *), void *arg) { const struct got_error *err; @@ -200,7 +200,7 @@ got_pathset_for_each(struct got_pathset *set, } const struct got_error * -got_pathset_for_each_reverse(struct got_pathset *set, +got_pathset_for_each_reverse_safe(struct got_pathset *set, const struct got_error *(*cb)(const char *, void *, void *), void *arg) { const struct got_error *err; blob - 7678188457876428a7f0c4d5234220f21a6f84bc blob + 56b380323951c2f2a1076ffd847d16bcd37724bf --- lib/worktree.c +++ lib/worktree.c @@ -862,7 +862,8 @@ remove_missing_files(struct got_worktree *worktree, co a2.cancel_arg = cancel_arg; a2.progress_cb = progress_cb; a2.progress_arg = progress_arg; - err = got_pathset_for_each(a.missing_entries, remove_missing_file, &a2); + err = got_pathset_for_each_safe(a.missing_entries, remove_missing_file, + &a2); got_pathset_free(a.missing_entries); return err; } blob - 55c5c62ef44ec2d7bae91e42cc2601549cbe618a blob + 9cd8b5a95ebbc11b42f2187aa0aebcc0a8a4aab5 --- regress/pathset/pathset_test.c +++ regress/pathset/pathset_test.c @@ -124,7 +124,7 @@ pathset_add_remove_iter(void) goto done; } - got_pathset_for_each(set, pathset_add_remove_iter_cb, NULL); + got_pathset_for_each_safe(set, pathset_add_remove_iter_cb, NULL); done: got_pathset_free(set); return (err == NULL); @@ -213,9 +213,9 @@ pathset_iter_order(void) goto done; test_printf("normal order:\n"); - got_pathset_for_each(set, pathset_iter_order_cb, NULL); + got_pathset_for_each_safe(set, pathset_iter_order_cb, NULL); test_printf("reverse order:\n"); - got_pathset_for_each_reverse(set, pathset_iter_reverse_order_cb, + got_pathset_for_each_reverse_safe(set, pathset_iter_reverse_order_cb, NULL); done: got_pathset_free(set);