All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Namhyung Kim <namhyung.kim@lge.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com,
	mingo@kernel.org, a.p.zijlstra@chello.nl, namhyung.kim@lge.com,
	namhyung@kernel.org, fweisbec@gmail.com, rostedt@goodmis.org,
	tglx@linutronix.de
Subject: [tip:perf/core] tools lib traceevent: Use local variable 'field'
Date: Fri, 6 Jul 2012 03:54:21 -0700	[thread overview]
Message-ID: <tip-b700807196ac8d87e00fed9fda80ab89b7f56db6@git.kernel.org> (raw)
In-Reply-To: <1340757701-10711-3-git-send-email-namhyung@kernel.org>

Commit-ID:  b700807196ac8d87e00fed9fda80ab89b7f56db6
Gitweb:     http://git.kernel.org/tip/b700807196ac8d87e00fed9fda80ab89b7f56db6
Author:     Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Wed, 27 Jun 2012 09:41:40 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 29 Jun 2012 13:28:12 -0300

tools lib traceevent: Use local variable 'field'

Use local variable 'field' to reduce typing. It is needed by later patch
not to exceed 80 column.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1340757701-10711-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index b203a50..63d02be 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -3214,6 +3214,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
 {
 	struct pevent *pevent = event->pevent;
 	struct print_flag_sym *flag;
+	struct format_field *field;
 	unsigned long long val, fval;
 	unsigned long addr;
 	char *str;
@@ -3228,27 +3229,29 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
 		print_str_to_seq(s, format, len_arg, arg->atom.atom);
 		return;
 	case PRINT_FIELD:
-		if (!arg->field.field) {
-			arg->field.field = pevent_find_any_field(event, arg->field.name);
-			if (!arg->field.field)
+		field = arg->field.field;
+		if (!field) {
+			field = pevent_find_any_field(event, arg->field.name);
+			if (!field)
 				die("field %s not found", arg->field.name);
+			arg->field.field = field;
 		}
 		/* Zero sized fields, mean the rest of the data */
-		len = arg->field.field->size ? : size - arg->field.field->offset;
+		len = field->size ? : size - field->offset;
 
 		/*
 		 * Some events pass in pointers. If this is not an array
 		 * and the size is the same as long_size, assume that it
 		 * is a pointer.
 		 */
-		if (!(arg->field.field->flags & FIELD_IS_ARRAY) &&
-		    arg->field.field->size == pevent->long_size) {
-			addr = *(unsigned long *)(data + arg->field.field->offset);
+		if (!(field->flags & FIELD_IS_ARRAY) &&
+		    field->size == pevent->long_size) {
+			addr = *(unsigned long *)(data + field->offset);
 			trace_seq_printf(s, "%lx", addr);
 			break;
 		}
 		str = malloc_or_die(len + 1);
-		memcpy(str, data + arg->field.field->offset, len);
+		memcpy(str, data + field->offset, len);
 		str[len] = 0;
 		print_str_to_seq(s, format, len_arg, str);
 		free(str);

  parent reply	other threads:[~2012-07-06 10:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27  0:41 [PATCH RESEND 1/4] tools lib traceevent: Check string is really printable Namhyung Kim
2012-06-27  0:41 ` [PATCH 2/4] KVM: Use __print_hex() for kvm_emulate_insn tracepoint Namhyung Kim
2012-06-27 12:49   ` Steven Rostedt
2012-06-27 12:54     ` Avi Kivity
2012-06-27 13:20       ` Steven Rostedt
2012-06-28  1:16         ` Namhyung Kim
2012-06-28  1:52           ` Steven Rostedt
2012-06-28  1:59             ` Namhyung Kim
2012-06-28  2:18               ` Steven Rostedt
2012-07-06 10:47   ` [tip:perf/core] tracing/kvm: " tip-bot for Namhyung Kim
2012-06-27  0:41 ` [PATCH 3/4] tools lib traceevent: Use local variable 'field' Namhyung Kim
2012-06-28 16:22   ` Arnaldo Carvalho de Melo
2012-07-06 10:54   ` tip-bot for Namhyung Kim [this message]
2012-06-27  0:41 ` [PATCH 4/4] tools lib traceevent: Add support for __print_hex() Namhyung Kim
2012-06-28 16:22   ` Arnaldo Carvalho de Melo
2012-07-06 10:55   ` [tip:perf/core] tools lib traceevent: Add support for __print_hex( ) tip-bot for Namhyung Kim

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=tip-b700807196ac8d87e00fed9fda80ab89b7f56db6@git.kernel.org \
    --to=namhyung.kim@lge.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --subject='Re: [tip:perf/core] tools lib traceevent: Use local variable '\''field'\''' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.