diff options
author | Simon Glass <sjg@chromium.org> | 2025-03-18 16:20:48 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-04-03 16:54:49 -0600 |
commit | da8694a7d2cc9fdfd67e8a039ba1e70bdd543d0b (patch) | |
tree | 640b17d9978b8c5fa0ecdb606ecf9cfbeae46884 | |
parent | 142a3cb63c81602ae4f48266a190ebceb483e536 (diff) |
membuf: Minor code-style improvements
Show the start in end in the comment. Comment a missing variable in
membuf_readline() and fix its line length.
Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | include/membuf.h | 6 | ||||
-rw-r--r-- | lib/membuf.c | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/membuf.h b/include/membuf.h index 636ed703ee7..46764690f53 100644 --- a/include/membuf.h +++ b/include/membuf.h @@ -25,7 +25,7 @@ * * .............xxxxxxxxxxxxxxxx......................... * ^ ^ - * tail head + * ^start tail head ^end * * xxxxxxxxxxxxx................xxxxxxxxxxxxxxxxxxxxxxxxx * ^ ^ @@ -194,11 +194,13 @@ int membuf_free(struct membuf *mb); * @mb: membuff to adjust * @str: Place to put the line * @maxlen: Maximum line length (excluding terminator) + * @minch: Minimum ASCII character to permit as part of the line (e.g. ' ') * @must_fit: If true then str is empty if line doesn't fit * Return: number of bytes read (including terminator) if a line has been * read, 0 if nothing was there or line didn't fit when must_fit is set */ -int membuf_readline(struct membuf *mb, char *str, int maxlen, int minch, bool must_fit); +int membuf_readline(struct membuf *mb, char *str, int maxlen, int minch, + bool must_fit); /** * membuf_extend_by() - expand a membuff diff --git a/lib/membuf.c b/lib/membuf.c index 695d16d051e..f38ff36cb0b 100644 --- a/lib/membuf.c +++ b/lib/membuf.c @@ -287,7 +287,8 @@ int membuf_free(struct membuf *mb) (mb->end - mb->start) - 1 - membuf_avail(mb); } -int membuf_readline(struct membuf *mb, char *str, int maxlen, int minch, bool must_fit) +int membuf_readline(struct membuf *mb, char *str, int maxlen, int minch, + bool must_fit) { int len; /* number of bytes read (!= string length) */ char *s, *end; |