public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: "Kubaj, Piotr" <piotr.kubaj@intel.com>
Cc: "Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
	"Ossowski, Tomasz" <tomasz.ossowski@intel.com>,
	"Dubel, Helena Anna" <helena.anna.dubel@intel.com>,
	"Niestepski, Daniel" <daniel.niestepski@intel.com>,
	"ltp@lists.linux.it" <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v8] thermal: add new test group
Date: Thu, 26 Feb 2026 14:23:11 +0100	[thread overview]
Message-ID: <aaBJP7DwAg10MOeT@yuki.lan> (raw)
In-Reply-To: <bb8f4252ef9830b359951cada2327e9eff3a956e.camel@intel.com>

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2026-02-26 13:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 10:00 [LTP] [PATCH v8] thermal: add new test group Piotr Kubaj
2026-02-25 13:18 ` Cyril Hrubis
2026-02-26 12:39   ` Kubaj, Piotr
2026-02-26 13:23     ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aaBJP7DwAg10MOeT@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=daniel.niestepski@intel.com \
    --cc=helena.anna.dubel@intel.com \
    --cc=ltp@lists.linux.it \
    --cc=piotr.kubaj@intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tomasz.ossowski@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox