On Wed, Apr 05, 2023 at 09:54:46AM +0100, Bruce Richardson wrote:
> 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.

i imagine there is an equivalent to asprintf for windows but keep in
mind it is not standard C so you'll have to do something conditional.

Reply via email to