mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
CLEANUP: buffer: use buffer_empty() instead of buffer_len()==0
A few places still made use of buffer_len()==0 to detect an empty buffer. Use the cleaner and more efficient buffer_empty() instead.
This commit is contained in:
parent
7d28149e92
commit
5fb3803f4b
@ -327,7 +327,7 @@ static inline void bo_skip(struct channel *chn, int len)
|
|||||||
{
|
{
|
||||||
chn->buf->o -= len;
|
chn->buf->o -= len;
|
||||||
|
|
||||||
if (buffer_len(chn->buf) == 0)
|
if (buffer_empty(chn->buf))
|
||||||
chn->buf->p = chn->buf->data;
|
chn->buf->p = chn->buf->data;
|
||||||
|
|
||||||
/* notify that some data was written to the SI from the buffer */
|
/* notify that some data was written to the SI from the buffer */
|
||||||
|
@ -63,7 +63,7 @@ int buffer_replace2(struct buffer *b, char *pos, char *end, const char *str, int
|
|||||||
|
|
||||||
b->i += delta;
|
b->i += delta;
|
||||||
|
|
||||||
if (buffer_len(b) == 0)
|
if (buffer_empty(b))
|
||||||
b->p = b->data;
|
b->p = b->data;
|
||||||
|
|
||||||
return delta;
|
return delta;
|
||||||
|
@ -331,7 +331,7 @@ static int raw_sock_from_buf(struct connection *conn, struct buffer *buf, int fl
|
|||||||
buf->o -= ret;
|
buf->o -= ret;
|
||||||
done += ret;
|
done += ret;
|
||||||
|
|
||||||
if (likely(!buffer_len(buf)))
|
if (likely(buffer_empty(buf)))
|
||||||
/* optimize data alignment in the buffer */
|
/* optimize data alignment in the buffer */
|
||||||
buf->p = buf->data;
|
buf->p = buf->data;
|
||||||
|
|
||||||
|
@ -1167,7 +1167,7 @@ static int ssl_sock_from_buf(struct connection *conn, struct buffer *buf, int fl
|
|||||||
buf->o -= ret;
|
buf->o -= ret;
|
||||||
done += ret;
|
done += ret;
|
||||||
|
|
||||||
if (likely(!buffer_len(buf)))
|
if (likely(buffer_empty(buf)))
|
||||||
/* optimize data alignment in the buffer */
|
/* optimize data alignment in the buffer */
|
||||||
buf->p = buf->data;
|
buf->p = buf->data;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user