Re: [PATCH v3 4/7] pkt-line: extern packet_length()
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 19, 2020, 16:23 UTC
- Message-ID
- <CAPig+cT1KfkszVW_Wvwz+r7Q0TsP+iTx-Cc3UvasS5ESBGdAAw@mail.gmail.com>
- In-Reply-To
- <36885943b239807eda49e231d8a45e1991f7288e.1589885479.git.liu.denton@gmail.com>
On Tue, May 19, 2020 at 6:54 AM Denton Liu <liu.denton@gmail.com> wrote:
Show 17 quoted lines
> [...] > Change the function parameter from `const char *linelen` to > `const char lenbuf_hex[4]`. Even though these two types behave > identically as function parameters, use the array notation to > semantically indicate exactly what this function is expecting as an > argument. Also, rename it from linelen to lenbuf_hex as the former > sounds like it should be an integral type which is misleading. > > Signed-off-by: Denton Liu <liu.denton@gmail.com> > --- > diff --git a/pkt-line.h b/pkt-line.h > @@ -74,6 +74,15 @@ int write_packetized_from_buf(const char *src_in, size_t len, int fd_out); > +/* > + * Convert a four hex digit packet line length header into its numeric > + * representation. > + * > + * If linelen contains non-hex characters, return -1. Otherwise, return the
s/linelen/lenbuf_hex/ ...or... s/lenbuf_hex/input argument/
> + * numeric value of the length header. > + */ > +int packet_length(const char lenbuf_hex[4]);