is it useless for function ngx_event_pipe_free_shadow_raw_buf

lihongfu nginx-forum at nginx.us
Sun Jan 2 17:03:07 MSK 2011


The function is in file ngx_event_pipe.c,it is not too long,but i am
confused by it.
when i debug it,it always says buf->shadow is NULL,and then return.so i
think it is useless.At the same time,i am confused how can  cl->buf
equal s.Thanks for your  explanations.The follow is the code.

static ngx_inline void
ngx_event_pipe_free_shadow_raw_buf(ngx_chain_t **free, ngx_buf_t *buf)
{
    ngx_buf_t    *s;
    ngx_chain_t  *cl, **ll;

    if (buf->shadow == NULL) {
        return;
    }

    for (s = buf->shadow; !s->last_shadow; s = s->shadow) { /* void */
}

    ll = free;

    for (cl = *free; cl; cl = cl->next) {
        if (cl->buf == s) {
            *ll = cl->next;
            break;
        }

        if (cl->buf->shadow) {
            break;
        }

        ll = &cl->next;
    }
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,162870,162870#msg-162870




More information about the nginx mailing list