From 5bf5516b291298706418121ccd72f350a6ba49c9 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka <valenok@gmail.com> Date: Mon, 30 Aug 2021 13:06:45 +0100 Subject: [PATCH] struct iobuf doc --- docs/README.md | 9 +++++++-- mongoose.h | 2 +- src/iobuf.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/README.md b/docs/README.md index 7bc75954d..07bd84aaf 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1354,12 +1354,17 @@ Usage example: ## IO Buffers +IO buffer, described by the `struct mg_iobuf`, is a simple data structure +that insert or delete chunks of data at arbitrary offsets and grow/shrink +automatically. + ### struct mg\_iobuf ```c struct mg_iobuf { - unsigned char *buf; - size_t size, len; + unsigned char *buf; // Pointer to stored data + size_t size; // Total size available + size_t len; // Current number of bytes }; ``` diff --git a/mongoose.h b/mongoose.h index 111993373..59c89101a 100644 --- a/mongoose.h +++ b/mongoose.h @@ -628,7 +628,7 @@ const char *mg_url_uri(const char *url); #include <stddef.h> struct mg_iobuf { - unsigned char *buf; // Data + unsigned char *buf; // Pointer to stored data size_t size; // Total size available size_t len; // Current number of bytes }; diff --git a/src/iobuf.h b/src/iobuf.h index c456e3bee..2c5b09fc0 100644 --- a/src/iobuf.h +++ b/src/iobuf.h @@ -3,7 +3,7 @@ #include <stddef.h> struct mg_iobuf { - unsigned char *buf; // Data + unsigned char *buf; // Pointer to stored data size_t size; // Total size available size_t len; // Current number of bytes }; -- GitLab