Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [ltt-dev] [PATCH 1/4] Make _ltt_trace_find simpler
@ 2008-10-23 10:45 Zhaolei
  2008-10-24 14:17 ` Mathieu Desnoyers
  0 siblings, 1 reply; 2+ messages in thread
From: Zhaolei @ 2008-10-23 10:45 UTC (permalink / raw)


Avoid using 2 local variables.

Impact: cleanup, no functionality changed

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, &ltt_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, &ltt_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






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-24 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-23 10:45 [ltt-dev] [PATCH 1/4] Make _ltt_trace_find simpler Zhaolei
2008-10-24 14:17 ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox