From: Mark Jamsek Subject: Re: gotwebd: don't got_ref_list per-commit in got_get_repo_commits To: Omar Polo Cc: gameoftrees@openbsd.org Date: Sun, 22 Jan 2023 21:09:00 +1100 On 23-01-22 09:38AM, Omar Polo wrote: > `refs' is already populated via got_ref_list before the loop begins, > so it's redundant and wasteful to re-list and free inside the loop, > other than probably a leak. yes, agreed. ok > diff -s /home/op/w/got > commit - 88a82656f65fee52fe135baccb76624ae8e1e2e4 > path + /home/op/w/got (staged changes) > blob - 78b5a2623d4338f679a254321a0a0647a5ff85fd > blob + cb7924b39f5629118d7515bb7ae7bce48d66c550 > --- gotwebd/got_operations.c > +++ gotwebd/got_operations.c > @@ -436,11 +436,6 @@ got_get_repo_commits(struct request *c, int limit) > if (error) > goto done; > > - error = got_ref_list(&refs, repo, NULL, got_ref_cmp_by_name, > - NULL); > - if (error) > - goto done; > - > error = got_init_repo_commit(&repo_commit); > if (error) > goto done; > @@ -505,7 +500,6 @@ got_get_repo_commits(struct request *c, int limit) > goto done; > } > } > - got_ref_list_free(&refs); > if (error || (limit && --limit == 0)) { > if (commit_found || (qs->file != NULL && > strlen(qs->file) > 0)) > -- Mark Jamsek GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68