Re: [PATCH 2/7] simple-ipc: preparations for supporting binary messages.
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Sep 15, 2021, 20:43 UTC
- Message-ID
- <CAPig+cQ0qbyBrCDcJgg7=DezWGfZhyAR=YuC=vbxd38B4WA=Xw@mail.gmail.com>
- In-Reply-To
- <7182419f6dfa49d4d8415736943c72a575ab6753.1631738177.git.gitgitgadget@gmail.com>
On Wed, Sep 15, 2021 at 4:36 PM Jeff Hostetler via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 8 quoted lines
> Add `command_len` argument to the Simple IPC API. > > In my original Simple IPC API, I assumed that the request > would always be a null-terminated string of text characters. > The command arg was just a `const char *`. > > I found a caller that would like to pass a binary command > to the daemon, so I want to ammend the Simple IPC API to
s/ammend/amend/
> take `const char *command, size_t command_len` and pass > that to the daemon. (Really, the first arg should just be > a `void *` or `const unsigned byte *` to make that clearer.)
The reader is left wondering why you didn't also change it to `const void *` (or one of the other choices) while at it.
Show 6 quoted lines
> Note, the response side has always been a `struct strbuf` > which includes the buffer and length, so we already support > returning a binary answer. (Yes, it feels a little weird > returning a binary buffer in a `strbuf`, but it works.) > > Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>