Re: [PATCH ps/stash-in-c] strbuf_vinsertf: provide the correct buffer size to vsnprintf
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Feb 6, 2019, 18:11 UTC
- Message-ID
- <f02e73e6-7e0e-6cd9-3d3a-b2b74d03f6be@kdbg.org>
- In-Reply-To
- <nycvar.QRO.7.76.6.1902061242380.41@tvgsbejvaqbjf.bet>
Am 06.02.19 um 12:56 schrieb Johannes Schindelin:
Show 14 quoted lines
> On Tue, 5 Feb 2019, Johannes Sixt wrote: >> Am 05.02.19 um 12:06 schrieb Johannes Schindelin: >>> The real examples are much more mundane, and very different from what you >>> suspected, e.g. inserting the tag header before the tag message in >>> `create_tag()` in `builtin/tag.c`. Basically, it is building up a strbuf >>> for the sake of calling `strbuf_insert()` to insert that string elsewhere. >> >> I had a look, and this example does not convince me at all. If >> separation of concerns were applied well around the launch_editor APIs, >> you would not need strbuf_insert() in the first place. But, alas, these >> functions focus more on DRY, and that is often the opposite of >> separation of concerns. > > So you actually are convinced that it is needed in this instance. Good.
I thought I said quite the opposite.
But never mind. Since I'm not going to help refactor any C code anyway as long as the result is still C code, who am I to complain about the existence of strbuf_vinsertf()?
-- Hannes