Skip to content
Snippets Groups Projects
Commit 0c4e6374 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Vladimir Davydov
Browse files

iostream: rename ctx to data

In SSL implementation iostream::ctx would point to a SSL object, while
a SSL_CTX object would be used for creating streams. Let's rename ctx to
data to avoid confusion.
parent a07f9143
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ plain_iostream_create(struct iostream *io, int fd)
{
assert(fd >= 0);
io->vtab = &plain_iostream_vtab;
io->ctx = NULL;
io->data = NULL;
io->fd = fd;
}
......@@ -33,9 +33,9 @@ iostream_close(struct iostream *io)
}
static void
plain_iostream_delete_ctx(void *ctx)
plain_iostream_destroy(struct iostream *io)
{
(void)ctx;
(void)io;
}
static ssize_t
......@@ -75,7 +75,7 @@ plain_iostream_writev(struct iostream *io, const struct iovec *iov, int iovcnt)
}
static const struct iostream_vtab plain_iostream_vtab = {
/* .delete_ctx = */ plain_iostream_delete_ctx,
/* .destroy = */ plain_iostream_destroy,
/* .read = */ plain_iostream_read,
/* .write = */ plain_iostream_write,
/* .writev = */ plain_iostream_writev,
......
......@@ -62,9 +62,9 @@ iostream_status_to_events(ssize_t status)
}
struct iostream_vtab {
/** Frees implementation-specific context. */
/** Destroys implementation-specific data. */
void
(*delete_ctx)(void *ctx);
(*destroy)(struct iostream *io);
/** See iostream_read. */
ssize_t
(*read)(struct iostream *io, void *buf, size_t count);
......@@ -82,8 +82,8 @@ struct iostream_vtab {
*/
struct iostream {
const struct iostream_vtab *vtab;
/** Implementation specific context. */
void *ctx;
/** Implementation specific data. */
void *data;
/** File descriptor used for IO. Set to -1 on destruction. */
int fd;
};
......@@ -95,7 +95,7 @@ static inline void
iostream_clear(struct iostream *io)
{
io->vtab = NULL;
io->ctx = NULL;
io->data = NULL;
io->fd = -1;
}
......@@ -142,7 +142,7 @@ static inline void
iostream_destroy(struct iostream *io)
{
assert(io->fd >= 0);
io->vtab->delete_ctx(io->ctx);
io->vtab->destroy(io);
iostream_clear(io);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment