From: compudj@krystal.dyndns.org (Mathieu Desnoyers)
Subject: [ltt-dev] [PATCH 1/4] Make _ltt_trace_find simpler
Date: Fri, 24 Oct 2008 10:17:39 -0400 [thread overview]
Message-ID: <20081024141739.GC24251@Krystal> (raw)
In-Reply-To: <490055D1.3080106@cn.fujitsu.com>
* Zhaolei (zhaolei at cn.fujitsu.com) wrote:
> Avoid using 2 local variables.
>
> Impact: cleanup, no functionality changed
>
Merged, thanks !
Mathieu
> Signed-off-by: Zhao Lei <zhaolei at cn.fujitsu.com>
> ---
> ltt/ltt-tracer.c | 16 +++++-----------
> 1 files changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/ltt/ltt-tracer.c b/ltt/ltt-tracer.c
> index bc8251b..92677a2 100644
> --- a/ltt/ltt-tracer.c
> +++ b/ltt/ltt-tracer.c
> @@ -259,19 +259,13 @@ static void async_wakeup(unsigned long data)
> * Returns a pointer to the trace structure, NULL if not found. */
> static struct ltt_trace_struct *_ltt_trace_find(char *trace_name)
> {
> - int compare;
> - struct ltt_trace_struct *trace, *found = NULL;
> -
> - list_for_each_entry(trace, <t_traces.head, list) {
> - compare = strncmp(trace->trace_name, trace_name, NAME_MAX);
> + struct ltt_trace_struct *trace;
>
> - if (compare == 0) {
> - found = trace;
> - break;
> - }
> - }
> + list_for_each_entry(trace, <t_traces.head, list)
> + if (!strncmp(trace->trace_name, trace_name, NAME_MAX))
> + return trace;
>
> - return found;
> + return NULL;
> }
>
> /* This function must be called with traces semaphore held. */
> --
> 1.5.5.3
>
>
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
prev parent reply other threads:[~2008-10-24 14:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-23 10:45 Zhaolei
2008-10-24 14:17 ` Mathieu Desnoyers [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=20081024141739.GC24251@Krystal \
--to=compudj@krystal.dyndns.org \
/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