From 50227f9b88b0aafacffbded499b87e32ab2e4127 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 15 Jun 2018 15:18:17 +0200 Subject: [PATCH] MINOR: buffer: use c_head() instead of buffer_wrap_sub(c->buf, p-o) This way we don't need o anymore. --- include/common/buffer.h | 8 -------- include/proto/channel.h | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/include/common/buffer.h b/include/common/buffer.h index dde0fcc..6f3ab26 100644 --- a/include/common/buffer.h +++ b/include/common/buffer.h @@ -61,14 +61,6 @@ void buffer_dump(FILE *o, struct buffer *b, int from, int to); /***** FIXME: OLD API BELOW *****/ -/* Normalizes a pointer after a subtract */ -static inline char *buffer_wrap_sub(const struct buffer *buf, char *ptr) -{ - if (ptr < buf->data) - ptr += buf->size; - return ptr; -} - /* Normalizes a pointer after an addition */ static inline char *buffer_wrap_add(const struct buffer *buf, char *ptr) { diff --git a/include/proto/channel.h b/include/proto/channel.h index 2cbbf96..b84ccc9 100644 --- a/include/proto/channel.h +++ b/include/proto/channel.h @@ -823,7 +823,7 @@ static inline int co_getchr(struct channel *chn) return -2; return -1; } - return *buffer_wrap_sub(chn->buf, chn->buf->p - chn->buf->o); + return *co_head(chn); } -- 1.7.10.4