On Tue, May 19, 2020 at 6:54 AM Denton Liu <liu.denton@xxxxxxxxx> wrote: > [...] > 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@xxxxxxxxx> > --- > 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]);