Welcome! Log In Create A New Profile

Advanced

question on some simple codes in ngx_buf.c

January 16, 2014 02:04AM
Hello there,

code snippet in the definition of ngx_chain_add_copy in ngx_buf.c:


ll = chain;

for (cl = *chain; cl; cl = cl->next) {
ll = &cl->next;
}


Why is ll assigned repeatedly? I'm sorry for failed thinking out any necessity.

And I modified the above as the following. Is it OK?


if (*chain) {
for (cl = *chain; cl->next; cl = cl->next) { /* void */ }
ll = &cl->next;
} else {
ll = chain;
}


Thank you very much.
Subject Author Posted

question on some simple codes in ngx_buf.c

microwish January 16, 2014 02:04AM

Re: question on some simple codes in ngx_buf.c

Maxim Dounin January 16, 2014 11:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 236
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready