lib: add void *ctx to reader/writer instances

- `struct Curl_cwriter` and `struct Curl_creader` now carry a
  `void *ctx` member that points to the instance as allocated.
- using `r->ctx` and `w->ctx` as pointer to the instance specific
  struct that has been allocated

Reported-by: Rudi Heitbaum
Fixes #13035
Closes #13059
This commit is contained in:
Stefan Eissing 2024-03-06 09:52:43 +01:00 committed by Daniel Stenberg
parent 2ca530d2fa
commit 9978d40ddb
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
8 changed files with 68 additions and 50 deletions

View file

@ -123,7 +123,7 @@ struct Curl_cwtype Curl_cwt_out = {
static CURLcode cw_out_init(struct Curl_easy *data,
struct Curl_cwriter *writer)
{
struct cw_out_ctx *ctx = (struct cw_out_ctx *)writer;
struct cw_out_ctx *ctx = writer->ctx;
(void)data;
ctx->buf = NULL;
return CURLE_OK;
@ -151,7 +151,7 @@ static size_t cw_out_bufs_len(struct cw_out_ctx *ctx)
static void cw_out_close(struct Curl_easy *data, struct Curl_cwriter *writer)
{
struct cw_out_ctx *ctx = (struct cw_out_ctx *)writer;
struct cw_out_ctx *ctx = writer->ctx;
(void)data;
cw_out_bufs_free(ctx);
@ -378,7 +378,7 @@ static CURLcode cw_out_write(struct Curl_easy *data,
struct Curl_cwriter *writer, int type,
const char *buf, size_t blen)
{
struct cw_out_ctx *ctx = (struct cw_out_ctx *)writer;
struct cw_out_ctx *ctx = writer->ctx;
CURLcode result;
bool flush_all;