On Tue, Apr 04, 2023 at 06:04:32PM -0700, Stephen Hemminger wrote:
> On Tue, 4 Apr 2023 09:47:21 +0100
> Bruce Richardson <bruce.richard...@intel.com> wrote:
> 
> > My suggestion is to use a combination of these methods. In json_snprintf
> > check if the input buffer is empty or has only one character in it, and use
> > method #2 if so. If that's not the case, then fallback to method #1 and do
> > a double snprintf.
> > 
> > Make sense? Any other suggestions?
> 
> Glibc has asprintf which allocates the buffer for you.

Good point, I'll use that in any new implementation. Thanks.

Reply via email to