Fix incorrect doc for stdio_put_string#2943
Conversation
|
@kilograham @lurch when you have a moment, would you mind taking a look? This is a doxygen-only change to |
c257b3b to
fba9c4d
Compare
|
Hi @anoshyn , as requested in other PRs, if you could update all of your pico-sdk PRs to remove the "Co-Authored-By: Claude" lines, that'd be helpful 👍 |
fba9c4d to
c2a8ef1
Compare
|
Force-pushed: dropped the |
| * | ||
| * This method returns as soon as input is available, but more characters may | ||
| * be returned up to the end of the buffer. | ||
| * Writes \p s in full to every registered stdio driver. The call returns once |
There was a problem hiding this comment.
I think I'd be tempted to do:
| * Writes \p s in full to every registered stdio driver. The call returns once | |
| * Writes \p s to every registered stdio driver. The call returns once |
as you could give a len shorter than s if you didn't want to write all of it. (But this is optional, given that Graham has already approved this PR.)
There was a problem hiding this comment.
Good catch — applied in 3dc5e04. "in full" did contradict the \param len line right below it.
The doxygen for stdio_put_string read "This method returns as soon as input is available, but more characters may be returned up to the end of the buffer." That text was copy-pasted from an input-reading helper (e.g. stdio_get_until); stdio_put_string is output-only and never returns early on its own. Rewrite to match what the implementation actually does and trim the prose so it no longer restates the \param descriptions: a one-line brief, plus two short sentences covering only what isn't in the params (writes the buffer in full, may block under driver back-pressure). The \param/\return lines pick up the len == -1 strlen convention and the return-0 path when PICO_STDIO_IGNORE_NESTED_STDOUT is set. Fixes raspberrypi#2818.
c2a8ef1 to
3dc5e04
Compare
Summary
The doxygen for
stdio_put_stringinsrc/rp2_common/pico_stdio/include/pico/stdio.hreads "This method returns as soon as input is available, but more characters may be returned up to the end of the buffer." That text was copy-pasted from an input-reading helper (e.g.stdio_get_until);stdio_put_stringis output-only and never returns early on its own. The wording is actively misleading because the function has anintreturn value, so a reader could plausibly assume some short-write behavior.Rewrite the description to match the implementation in
stdio.c:92-114:len == -1→strlenconvention;cr_translationbehavior (applies to any appended newline too);0-return edge case whenPICO_STDIO_IGNORE_NESTED_STDOUTis set and a concurrent stdout write is in progress.No behavior change; doxygen only.
Fixes #2818.
Test plan
git diff— onlysrc/rp2_common/pico_stdio/include/pico/stdio.his touched; only the doxygen block forstdio_put_string.stdio_put_string.