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.