buffer.h: Fix buf_substring_len() documentation
PATCH 1/1 buffer.h: Fix buf_substring_len() documentation
The documentation added in 21ef7fa8 described neither the return value nor the not-found case correctly: the count includes the delimiter, and a missing delimiter yields -1 rather than the buffer length.
--- src/openvpn/buffer.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
src/openvpn/buffer.h +6 -6
@@ -1605,17 +1605,17 @@ bool buf_string_match_head_str(const struct buffer *src, const char *match);bool buf_string_compare_advance (struct buffer *src,const char *match);/** -* Return the length of the next token in a buffer up to a delimiter. +* Return the number of bytes in a buffer up to and including a delimiter. * -* Scans the buffer content for \c delim and returns the number of bytes -* up to (but not including) the delimiter, or the full buffer length if -* the delimiter is not found. +* The count includes the delimiter byte, so it can be passed straight to +* \c buf_copy_excess() to split off a complete record, keeping the +* delimiter with it. * * @param buf The buffer to scan. * @param delim Delimiter byte to search for. * -* @return Number of bytes before the first occurrence of \c delim, or -1 -* if the buffer is empty. +* @return Byte count including the first \c delim, or -1 if the buffer +* contains no \c delim. */ int buf_substring_len (const struct buffer *buf,int delim);
Signature · 8 lines
2.55.0 _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Quoted 3 lines · Razvan Cojocaru via Openvpn-devel
The documentation added in
21ef7fa8described neither the return value nor the not-found case correctly: the count includes the delimiter, and a missing delimiter yields -1 rather than the buffer length.
Hrm, not sure how I ended up with this.
Thanks,
Signature · 7 lines
Frank Lichtenheld _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Your patch has been applied to the master branch.
commit 9b114749d9db9918fa951814cf2d8f4827b3947e
Author: Razvan Cojocaru via Openvpn-devel Date: Wed Aug 12 17:05:15 2026 +0300
buffer.h: Fix buf_substring_len() documentation
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg38289.html
--
kind regards,
Gert Doering
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Hi,
Quoted 5 lines · Gert Doering
Your patch has been applied to the master branch.
commit
9b114749d9db9918fa951814cf2d8f4827b3947eAuthor: Razvan Cojocaru via Openvpn-devel Date: Wed Aug 12 17:05:15 2026 +0300
*sigh* damn DMARC header massacre...
fixed that, new commit ID of course
commit a743a67b84ef0324f163a949a4db07e0c4f30799 (HEAD -> master)
Author: Razvan Cojocaru <[email protected]> Date: Sat Aug 15 21:32:47 2026 +0200
buffer.h: Fix buf_substring_len() documentation
pushed *now*.
(I do have a pre-push hook that prevents me from pushing with a DMARC-garbled author, but AFAIK you can't install that as a pre-commit hook and I didn't notice the refusal to push before leaving for the weekend...)
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel