Re: [PATCH 4/6] pkt-line: extern packet_length()
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 13, 2020, 23:23 UTC
- Message-ID
- <CAPig+cQpQsoCg4ujASek3RP7HhHVpgprXbekGQJKseX=tbYYfw@mail.gmail.com>
- In-Reply-To
- <891a39c853ce3669b6167dc9ad8a2328e4321a9e.1589393036.git.liu.denton@gmail.com>
On Wed, May 13, 2020 at 2:07 PM Denton Liu <liu.denton@gmail.com> wrote:
Show 12 quoted lines
> 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 <liu.denton@gmail.com> > --- > 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).