[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] not make full use of evbuffer_chain



In libevent-2.0.8-rc, buffer.c: evbuffer_add()

Code was:
1470 in evbuffer_add(struct evbuffer *buf, const void *data_in, size_t datlen)
1471 {
         ....
1505 } else if ((size_t)chain->misalign >= datlen && !CHAIN_PINNED(chain)) {
         ....
1551 }

I think it does not make full use of misalign space in front of evbuffer_chain in line 1505.
It is more likely should be as follow:

1470 in evbuffer_add(struct evbuffer *buf, const void *data_in, size_t datlen)
1471 {
         ....
1505 } else if ((size_t)(chain->buffer_len -  chain->off) >= datlen && !CHAIN_PINNED(chain)) {
         ....
1551 }

Am I correct?

Thanks,
Yan Lin