[PATCH 1/2] telemetry: use malloc instead of variable length array
Stephen Hemminger
stephen at networkplumber.org
Wed Apr 5 03:04:32 CEST 2023
On Tue, 4 Apr 2023 09:47:21 +0100
Bruce Richardson <bruce.richardson at 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.
More information about the dev
mailing list