[PATCH 1/2] telemetry: use malloc instead of variable length array
Stephen Hemminger
stephen at networkplumber.org
Wed Apr 5 03:20:04 CEST 2023
On Tue, 4 Apr 2023 10:34:01 -0700
Tyler Retzlaff <roretzla at linux.microsoft.com> wrote:
> > > > I think suggestion #2 above should cover most cases, in which case using
> > > > your original suggestion of malloc would be ok too for the rare case (if
> > > > ever) where we don't just have one terminator on the end.
> > >
> > > maybe a dumb'd down compromise is to have a fixed stack limit and then
> > > if it is exceeded always just go to malloc/free?
> > >
> > Perhaps. If you like, I have have a try at implementing my own suggestions
> > above tomorrow. I'd like if we can get the "single-character-saving" option
> > working, because that would be the most efficient method of all.
>
> that would be great, i'll take the help i can get.
For the json print library in iproute2, it streams output using
stdio, which avoids lots of string processing issues. Well, it moves them
to be standard library.
More information about the dev
mailing list