]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/io_tty_process_input: add a few comments
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 17 Sep 2020 09:14:50 +0000 (11:14 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 2 Oct 2020 06:50:27 +0000 (08:50 +0200)
daemon/io.c

index 1e55134718226887048f24b5133baa857fa56354..8c929ecf20c36eb72e09645ecf199c24acb1926f 100644 (file)
@@ -445,8 +445,8 @@ enum io_stream_mode {
 
 struct io_stream_data {
        enum io_stream_mode mode;
-       size_t blen;
-       char *buf;
+       size_t blen; ///< length of `buf`
+       char *buf;  ///< growing buffer residing on `pool` (mp_append_*)
        knot_mm_t *pool;
 };
 
@@ -481,6 +481,7 @@ void io_tty_process_input(uv_stream_t *stream, ssize_t nread, const uv_buf_t *bu
                }
        }
 
+       /** The current single command and the remaining command(s). */
        char *cmd, *cmd_next = NULL;
        bool incomplete_cmd = false;
 
@@ -511,6 +512,7 @@ void io_tty_process_input(uv_stream_t *stream, ssize_t nread, const uv_buf_t *bu
                cmd_next = strtok(NULL, "\n");
        }
 
+       /** Moving pointer to end of buffer with incomplete command. */
        char *pbuf = data->buf + data->blen;
        lua_State *L = the_worker->engine->L;
        while (cmd != NULL) {