[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181219153002.62ede7e9@gandalf.local.home>
Date: Wed, 19 Dec 2018 15:30:02 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Joe Perches <joe@...ches.com>
Cc: Tom Zanussi <zanussi@...nel.org>, tglx@...utronix.de,
mhiramat@...nel.org, namhyung@...nel.org, vedang.patel@...el.com,
bigeasy@...utronix.de, joel@...lfernandes.org,
mathieu.desnoyers@...icios.com, julia@...com,
linux-kernel@...r.kernel.org, linux-rt-users@...r.kernel.org
Subject: Re: [PATCH 2/7] tracing: Change strlen to sizeof for hist trigger
static strings
On Wed, 19 Dec 2018 12:20:19 -0800
Joe Perches <joe@...ches.com> wrote:
> > Yeah, I had considered it but wasn't sure it was worth it. Since
> > you're suggesting it is, I can send another patch on top of these, or
> > feel free if you want to too. ;-)
>
> I believe the 'strlen("foo") -> sizeof("foo") - 1'
> conversions do not change objects at all.
>
> strlen("constant") is already optimized by gcc to a
> constant value when fed a constant string.
If that's the case (and it probably is), then yeah, strlen is probably
better. As it can handle the "not a constant" that you stated in
another email.
-- Steve
>
> the strcmp_const macro does seem to make sense as
> the copy/paste/typo possibility is real.
Powered by blists - more mailing lists