On 11. Aug 2025, at 17:08, Thorsten Blum wrote:
On 11. Aug 2025, at 14:51, Franco Martelli wrote:
Is there a rationale behind the choice to avoid to use snprintf() in these circumstance? Preferring snprintf() you will not have to take care to compute the position of the NULL terminating character of the string, it's done automatically by this function.
I looked into it a bit more and I think we need neither strncpy() nor snprintf() (and no temporary buffer) because this should be sufficient:
mvwprintw(win, i, 0, "%.*s", len, line);
Unless I'm missing something, I'm happy to send a v2.
I submitted this as a new patch instead of a v2:
https://lore.kernel.org/lkml/20250811161650.37428-2-thorsten.blum@linux.dev/
Thanks, Thorsten