[PATCH v4 13/13] Static: optimize "index" iteration
Alejandro Colomar (man-pages)
alx.manpages at gmail.com
Fri Dec 24 12:16:14 UTC 2021
On 12/24/21 01:24, Valentin V. Bartenev wrote:
>> diff --git a/src/nxt_http_static.c b/src/nxt_http_static.c
>> index 30b7fd6..50f63b2 100644
>> --- a/src/nxt_http_static.c
>> +++ b/src/nxt_http_static.c
>> @@ -711,7 +711,13 @@ nxt_http_static_next(nxt_task_t *task, nxt_http_request_t *r,
>> action = ctx->action;
>> conf = action->u.conf;
>>
>> - ctx->index_idx = (ctx->index_idx + 1) % conf->nindices;
>> + if (ctx->share.start[ctx->share.length - 1] == '/') {
>> + ctx->index_idx = (ctx->index_idx + 1) % conf->nindices;
>> +
>> + } else {
>> + ctx->index_idx = 0;
>> + }
>> +
> [..]
>
> What's the reason for this "else"?
> Isn't ctx->index_idx always 0 in this case?
Oops, you're right. I'll remove it.
Thanks,
Alex
--
Alejandro Colomar
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
More information about the unit
mailing list