]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: buffer: use buffer_empty() instead of buffer_len()==0
authorWilly Tarreau <w@1wt.eu>
Sun, 16 Dec 2012 18:39:09 +0000 (19:39 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 17 Dec 2012 00:14:49 +0000 (01:14 +0100)
A few places still made use of buffer_len()==0 to detect an empty
buffer. Use the cleaner and more efficient buffer_empty() instead.

include/proto/channel.h
src/buffer.c
src/raw_sock.c
src/ssl_sock.c

index eb40140f7c126020d47f29319fa3f46a6ef46b65..44cb890123914a16f02a09442c926731a1a393da 100644 (file)
@@ -327,7 +327,7 @@ static inline void bo_skip(struct channel *chn, int len)
 {
        chn->buf->o -= len;
 
-       if (buffer_len(chn->buf) == 0)
+       if (buffer_empty(chn->buf))
                chn->buf->p = chn->buf->data;
 
        /* notify that some data was written to the SI from the buffer */
index d7f7ae15da2578ac7e763b0b5f44d28fbe49227d..60fb3fce521ee0f9a9edcf9cce7baad90b7b4587 100644 (file)
@@ -63,7 +63,7 @@ int buffer_replace2(struct buffer *b, char *pos, char *end, const char *str, int
 
        b->i += delta;
 
-       if (buffer_len(b) == 0)
+       if (buffer_empty(b))
                b->p = b->data;
 
        return delta;
index 4c83a6f88efe5db6cdea2c2c0a3f80f4e973bc70..20a867add07c9beca317c96ef7ae56386b362524 100644 (file)
@@ -331,7 +331,7 @@ static int raw_sock_from_buf(struct connection *conn, struct buffer *buf, int fl
                        buf->o -= ret;
                        done += ret;
 
-                       if (likely(!buffer_len(buf)))
+                       if (likely(buffer_empty(buf)))
                                /* optimize data alignment in the buffer */
                                buf->p = buf->data;
 
index 99f22f6839d8ef5ba608d47802842cb955c23e8e..3e74ce5463d6491b8804009d0b5c4d0293911d4a 100644 (file)
@@ -1167,7 +1167,7 @@ static int ssl_sock_from_buf(struct connection *conn, struct buffer *buf, int fl
                        buf->o -= ret;
                        done += ret;
 
-                       if (likely(!buffer_len(buf)))
+                       if (likely(buffer_empty(buf)))
                                /* optimize data alignment in the buffer */
                                buf->p = buf->data;