[LTP] [PATCH v8] thermal: add new test group
Cyril Hrubis
chrubis@suse.cz
Thu Feb 26 14:23:11 CET 2026
Hi!
> > > + int sleep_time = SLEEP;
> > > + double run_time = RUNTIME;
> > > +
> > > + snprintf(path, NAME_MAX,
> > > "/sys/class/thermal/thermal_zone%d/", i);
> > > + strncpy(temp_path, path, NAME_MAX);
> > > + strncat(temp_path, "temp", 4);
> >
> > Why just not use a single snprintf()?
> That has already been asked before. path variable is also used later on
> in the test.
Doing strncpy() and strncat() is slower than having single snprintf()
per path and the code is also longer. We do not save anythign with
constructing the path prefix beforehand.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list