Download raw body.
gotwebd: use prev_display instead of hardcoding d_i - 2
On 22-11-22 12:05PM, Omar Polo wrote: > Extracted for ease of review from a previous (pending) diff about > refactoring gotweb_render_index. yes, this makes sense. ok > ----------------------------------------------- > commit 0ceb1b9e49ae865b84f237977d7edbcaa9697161 > from: Omar Polo <op@omarpolo.com> > date: Tue Nov 22 11:00:49 2022 UTC > > gotwebd: use prev_disp to decide when to we've reached max_repos > > instead of hardcoding d_i - 2 and so expecting only "." and ".." as > skipped entries, use t->prev_disp that is the number of repositories > traversed until now (both skipped due to the pagination and the ones > actually rendered.) > > diff e18d071f3cc8912b9bfb6fb392689dc7394355dd 0ceb1b9e49ae865b84f237977d7edbcaa9697161 > commit - e18d071f3cc8912b9bfb6fb392689dc7394355dd > commit + 0ceb1b9e49ae865b84f237977d7edbcaa9697161 > blob - 7cb4b4aa6c9a239aeb25328ef01b302f2131753a > blob + fdc41cd4d2cb16ff84e4c42c6a8c826e6f239dc0 > --- gotwebd/gotweb.c > +++ gotwebd/gotweb.c > @@ -1051,8 +1051,8 @@ gotweb_render_index(struct request *c) > goto done; > > for (d_i = 0; d_i < d_cnt; d_i++) { > - if (srv->max_repos > 0 && (d_i - 2) == srv->max_repos) > - break; /* account for parent and self */ > + if (srv->max_repos > 0 && t->prev_disp == srv->max_repos) > + break; > > if (strcmp(sd_dent[d_i]->d_name, ".") == 0 || > strcmp(sd_dent[d_i]->d_name, "..") == 0) > > -- Mark Jamsek <fnc.bsdbox.org> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
gotwebd: use prev_display instead of hardcoding d_i - 2