Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

question on some simple codes in ngx_buf.c (1 reply)

$
0
0
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.

Viewing all articles
Browse latest Browse all 7229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>