MINOR: buffer: remove bo_ptr()
It was replaced by co_head() when a channel was known, otherwise b_head().
diff --git a/include/common/buffer.h b/include/common/buffer.h
index baa8631..fcb61f3 100644
--- a/include/common/buffer.h
+++ b/include/common/buffer.h
@@ -117,16 +117,6 @@
return ret;
}
-/* Returns the start of the output data in a buffer */
-static inline char *bo_ptr(const struct buffer *b)
-{
- char *ret = b->p - b->o;
-
- if (ret < b->data)
- ret += b->size;
- return ret;
-}
-
/* Returns the end of the output data in a buffer */
static inline char *bo_end(const struct buffer *b)
{
@@ -417,14 +407,14 @@
if (len + offset > buf->o)
return 0;
- firstblock = buf->data + buf->size - bo_ptr(buf);
+ firstblock = buf->data + buf->size - b_head(buf);
if (firstblock > offset) {
if (firstblock >= len + offset) {
- memcpy(blk, bo_ptr(buf) + offset, len);
+ memcpy(blk, b_head(buf) + offset, len);
return len;
}
- memcpy(blk, bo_ptr(buf) + offset, firstblock - offset);
+ memcpy(blk, b_head(buf) + offset, firstblock - offset);
memcpy(blk + firstblock - offset, buf->data, len - firstblock + offset);
return len;
}
@@ -452,7 +442,7 @@
return 2;
}
- *blk1 = bo_ptr(buf);
+ *blk1 = b_head(buf);
*len1 = buf->o;
return 1;
}
diff --git a/src/buffer.c b/src/buffer.c
index 127def2..5085e72 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -90,8 +90,8 @@
return 0; /* no space left */
if (buffer_not_empty(b) &&
- bi_end(b) + delta > bo_ptr(b) &&
- bo_ptr(b) >= bi_end(b))
+ bi_end(b) + delta > b_head(b) &&
+ b_head(b) >= bi_end(b))
return 0; /* no space left before wrapping data */
/* first, protect the end of the buffer */
@@ -129,8 +129,8 @@
return 0; /* no space left */
if (buffer_not_empty(b) &&
- bi_end(b) + delta > bo_ptr(b) &&
- bo_ptr(b) >= bi_end(b))
+ bi_end(b) + delta > b_head(b) &&
+ b_head(b) >= bi_end(b))
return 0; /* no space left before wrapping data */
/* first, protect the end of the buffer */
diff --git a/src/channel.c b/src/channel.c
index 0ddfc6f..4f2346b 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -256,7 +256,7 @@
goto out;
}
- p = bo_ptr(chn->buf);
+ p = b_head(chn->buf);
if (max > chn->buf->o) {
max = chn->buf->o;
diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c
index 2084397..d80dc08 100644
--- a/src/flt_http_comp.c
+++ b/src/flt_http_comp.c
@@ -721,7 +721,7 @@
/* Copy previous data from ib->o into ob->o */
if (ib->o > 0) {
left = bo_contig_data(ib);
- memcpy(ob->p - ob->o, bo_ptr(ib), left);
+ memcpy(ob->p - ob->o, b_head(ib), left);
if (ib->o - left) /* second part of the buffer */
memcpy(ob->p - ob->o + left, ib->data, ib->o - left);
}
diff --git a/src/mux_h2.c b/src/mux_h2.c
index b7b98aa..afd33cb 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -2969,7 +2969,7 @@
* block does not wrap and we can safely read it this way without
* having to realign the buffer.
*/
- ret = h1_headers_to_hdr_list(bo_ptr(buf), bo_ptr(buf) + buf->o,
+ ret = h1_headers_to_hdr_list(b_head(buf), b_head(buf) + buf->o,
list, sizeof(list)/sizeof(list[0]), h1m);
if (ret <= 0) {
/* incomplete or invalid response, this is abnormal coming from
diff --git a/src/raw_sock.c b/src/raw_sock.c
index ad02101..0e1f971 100644
--- a/src/raw_sock.c
+++ b/src/raw_sock.c
@@ -396,7 +396,7 @@
if (try < buf->o || flags & CO_SFL_MSG_MORE)
send_flag |= MSG_MORE;
- ret = send(conn->handle.fd, bo_ptr(buf), try, send_flag);
+ ret = send(conn->handle.fd, b_head(buf), try, send_flag);
if (ret > 0) {
buf->o -= ret;
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 3f70b12..60fce0d 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -5562,7 +5562,7 @@
break;
}
}
- ret = SSL_write_early_data(conn->xprt_ctx, bo_ptr(buf), try, &written_data);
+ ret = SSL_write_early_data(conn->xprt_ctx, b_head(buf), try, &written_data);
if (ret == 1) {
ret = written_data;
conn->sent_early_data += ret;
@@ -5575,7 +5575,7 @@
} else
#endif
- ret = SSL_write(conn->xprt_ctx, bo_ptr(buf), try);
+ ret = SSL_write(conn->xprt_ctx, b_head(buf), try);
if (conn->flags & CO_FL_ERROR) {
/* CO_FL_ERROR may be set by ssl_sock_infocbk */
diff --git a/src/stats.c b/src/stats.c
index aee3a0f..aa4aaaa 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -1844,7 +1844,7 @@
scope_txt[0] = 0;
if (appctx->ctx.stats.scope_len) {
strcpy(scope_txt, STAT_SCOPE_PATTERN);
- memcpy(scope_txt + strlen(STAT_SCOPE_PATTERN), bo_ptr(si_ob(si)) + appctx->ctx.stats.scope_str, appctx->ctx.stats.scope_len);
+ memcpy(scope_txt + strlen(STAT_SCOPE_PATTERN), co_head(si_oc(si)) + appctx->ctx.stats.scope_str, appctx->ctx.stats.scope_len);
scope_txt[strlen(STAT_SCOPE_PATTERN) + appctx->ctx.stats.scope_len] = 0;
}
@@ -2006,7 +2006,7 @@
* name does not match, skip it.
*/
if (appctx->ctx.stats.scope_len &&
- strnistr(px->id, strlen(px->id), bo_ptr(si_ob(si)) + appctx->ctx.stats.scope_str, appctx->ctx.stats.scope_len) == NULL)
+ strnistr(px->id, strlen(px->id), co_head(si_oc(si)) + appctx->ctx.stats.scope_str, appctx->ctx.stats.scope_len) == NULL)
return 1;
if ((appctx->ctx.stats.flags & STAT_BOUND) &&
@@ -2335,7 +2335,7 @@
);
/* scope_txt = search query, appctx->ctx.stats.scope_len is always <= STAT_SCOPE_TXT_MAXLEN */
- memcpy(scope_txt, bo_ptr(si_ob(si)) + appctx->ctx.stats.scope_str, appctx->ctx.stats.scope_len);
+ memcpy(scope_txt, co_head(si_oc(si)) + appctx->ctx.stats.scope_str, appctx->ctx.stats.scope_len);
scope_txt[appctx->ctx.stats.scope_len] = '\0';
chunk_appendf(&trash,
@@ -2347,7 +2347,7 @@
scope_txt[0] = 0;
if (appctx->ctx.stats.scope_len) {
strcpy(scope_txt, STAT_SCOPE_PATTERN);
- memcpy(scope_txt + strlen(STAT_SCOPE_PATTERN), bo_ptr(si_ob(si)) + appctx->ctx.stats.scope_str, appctx->ctx.stats.scope_len);
+ memcpy(scope_txt + strlen(STAT_SCOPE_PATTERN), co_head(si_oc(si)) + appctx->ctx.stats.scope_str, appctx->ctx.stats.scope_len);
scope_txt[strlen(STAT_SCOPE_PATTERN) + appctx->ctx.stats.scope_len] = 0;
}
@@ -2983,7 +2983,7 @@
scope_txt[0] = 0;
if (appctx->ctx.stats.scope_len) {
strcpy(scope_txt, STAT_SCOPE_PATTERN);
- memcpy(scope_txt + strlen(STAT_SCOPE_PATTERN), bo_ptr(si_ob(si)) + appctx->ctx.stats.scope_str, appctx->ctx.stats.scope_len);
+ memcpy(scope_txt + strlen(STAT_SCOPE_PATTERN), co_head(si_oc(si)) + appctx->ctx.stats.scope_str, appctx->ctx.stats.scope_len);
scope_txt[strlen(STAT_SCOPE_PATTERN) + appctx->ctx.stats.scope_len] = 0;
}