MINOR: buffer: convert most b_ptr() calls to c_ptr()
The latter uses the channel wherever a channel is known.
diff --git a/src/backend.c b/src/backend.c
index 70972b4..ea266f3 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -322,7 +322,7 @@
struct proxy *px = s->be;
unsigned int plen = px->url_param_len;
unsigned long len = http_body_bytes(msg);
- const char *params = b_ptr(req->buf, -http_data_rewind(msg));
+ const char *params = c_ptr(req, -http_data_rewind(msg));
const char *p = params;
const char *start, *end;
@@ -412,7 +412,7 @@
ctx.idx = 0;
/* if the message is chunked, we skip the chunk size, but use the value as len */
- http_find_header2(px->hh_name, plen, b_ptr(s->req.buf, -http_hdr_rewind(&txn->req)), &txn->hdr_idx, &ctx);
+ http_find_header2(px->hh_name, plen, c_ptr(&s->req, -http_hdr_rewind(&txn->req)), &txn->hdr_idx, &ctx);
/* if the header is not found or empty, let's fallback to round robin */
if (!ctx.idx || !ctx.vlen)
@@ -669,7 +669,7 @@
if (!s->txn || s->txn->req.msg_state < HTTP_MSG_BODY)
break;
srv = get_server_uh(s->be,
- b_ptr(s->req.buf, -http_uri_rewind(&s->txn->req)),
+ c_ptr(&s->req, -http_uri_rewind(&s->txn->req)),
s->txn->req.sl.rq.u_l);
break;
@@ -679,7 +679,7 @@
break;
srv = get_server_ph(s->be,
- b_ptr(s->req.buf, -http_uri_rewind(&s->txn->req)),
+ c_ptr(&s->req, -http_uri_rewind(&s->txn->req)),
s->txn->req.sl.rq.u_l);
if (!srv && s->txn->meth == HTTP_METH_POST)
diff --git a/src/channel.c b/src/channel.c
index ad309b8..b720024 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -98,7 +98,7 @@
memcpy(chn->buf->p, msg, len);
chn->buf->o += len;
- chn->buf->p = b_ptr(chn->buf, len);
+ chn->buf->p = c_ptr(chn, len);
chn->total += len;
return -1;
}
diff --git a/src/h1.c b/src/h1.c
index 8b8545d..f070116 100644
--- a/src/h1.c
+++ b/src/h1.c
@@ -14,6 +14,7 @@
#include <common/config.h>
#include <common/http-hdr.h>
+#include <proto/channel.h>
#include <proto/h1.h>
#include <proto/hdr_idx.h>
@@ -1291,7 +1292,7 @@
msg->sol = 0;
while (1) {
const char *p1 = NULL, *p2 = NULL;
- const char *start = b_ptr(buf, msg->next + msg->sol);
+ const char *start = c_ptr(msg->chn, msg->next + msg->sol);
const char *stop = b_tail(buf);
const char *ptr = start;
int bytes = 0;
diff --git a/src/proto_http.c b/src/proto_http.c
index 7b7f46c..5d7fc98 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -1111,7 +1111,7 @@
c_rew(&s->req, rewind = http_hdr_rewind(&txn->req));
path = http_get_path(txn);
- len = buffer_count(s->req.buf, path, b_ptr(s->req.buf, txn->req.sl.rq.u + txn->req.sl.rq.u_l));
+ len = buffer_count(s->req.buf, path, c_ptr(&s->req, txn->req.sl.rq.u + txn->req.sl.rq.u_l));
c_adv(&s->req, rewind);
@@ -1650,7 +1650,7 @@
req->flags |= CF_WAKE_WRITE;
return 0;
}
- if (unlikely(ci_tail(req) < b_ptr(req->buf, msg->next) ||
+ if (unlikely(ci_tail(req) < c_ptr(req, msg->next) ||
ci_tail(req) > req->buf->data + req->buf->size - global.tune.maxrewrite))
channel_slow_realign(req, trash.str);
}
@@ -5137,7 +5137,7 @@
return 0;
}
- if (unlikely(ci_tail(rep) < b_ptr(rep->buf, msg->next) ||
+ if (unlikely(ci_tail(rep) < c_ptr(rep, msg->next) ||
ci_tail(rep) > rep->buf->data + rep->buf->size - global.tune.maxrewrite))
channel_slow_realign(rep, trash.str);
@@ -9919,7 +9919,7 @@
msg = &smp->strm->txn->rsp;
len = http_body_bytes(msg);
- body = b_ptr(msg->chn->buf, -http_data_rewind(msg));
+ body = c_ptr(msg->chn, -http_data_rewind(msg));
block1 = len;
if (block1 > msg->chn->buf->data + msg->chn->buf->size - body)
@@ -11390,7 +11390,7 @@
msg = &smp->strm->txn->rsp;
len = http_body_bytes(msg);
- body = b_ptr(msg->chn->buf, -http_data_rewind(msg));
+ body = c_ptr(msg->chn, -http_data_rewind(msg));
block1 = len;
if (block1 > msg->chn->buf->data + msg->chn->buf->size - body)