From: Eric Sunshine Date: Wed, 13 May 2020 23:23:52 GMT Subject: Re: [PATCH 4/6] pkt-line: extern packet_length() Message-ID: In-Reply-To: <891a39c853ce3669b6167dc9ad8a2328e4321a9e.1589393036.git.liu.denton@gmail.com> On Wed, May 13, 2020 at 2:07 PM Denton Liu wrote: > In a future commit, we will be manually processing packets and we will > need to access the length header. In order to simplify this, extern > packet_length() so that the logic can be reused. > > Signed-off-by: Denton Liu > --- > diff --git a/pkt-line.c b/pkt-line.c > @@ -306,7 +306,7 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size, > +/* > + * Reads a packetized line and returns the length header of the packet. > + */ > +int packet_length(const char *linelen); The function comment seems rather gobbledy-gooky to me. Perhaps it could be clearer by saying something along the lines of the input being a hexadecimal 2-digit representation of a packet length and that the function converts it to a numeric value (between 0 and 255).