diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-06-26 20:41:40 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-06-29 12:28:12 -0400 |
commit | b700807196ac8d87e00fed9fda80ab89b7f56db6 (patch) | |
tree | 2d8a185ababb1d47fb207becf9acc935955a4bd8 /tools | |
parent | 600da3cfe19496485c5d8d52ff703590a0bd53f6 (diff) |
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>
Diffstat (limited to 'tools')
-rw-r--r-- | 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 b203a50c0f22..63d02be5480f 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, | |||
3214 | { | 3214 | { |
3215 | struct pevent *pevent = event->pevent; | 3215 | struct pevent *pevent = event->pevent; |
3216 | struct print_flag_sym *flag; | 3216 | struct print_flag_sym *flag; |
3217 | struct format_field *field; | ||
3217 | unsigned long long val, fval; | 3218 | unsigned long long val, fval; |
3218 | unsigned long addr; | 3219 | unsigned long addr; |
3219 | char *str; | 3220 | char *str; |
@@ -3228,27 +3229,29 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
3228 | print_str_to_seq(s, format, len_arg, arg->atom.atom); | 3229 | print_str_to_seq(s, format, len_arg, arg->atom.atom); |
3229 | return; | 3230 | return; |
3230 | case PRINT_FIELD: | 3231 | case PRINT_FIELD: |
3231 | if (!arg->field.field) { | 3232 | field = arg->field.field; |
3232 | arg->field.field = pevent_find_any_field(event, arg->field.name); | 3233 | if (!field) { |
3233 | if (!arg->field.field) | 3234 | field = pevent_find_any_field(event, arg->field.name); |
3235 | if (!field) | ||
3234 | die("field %s not found", arg->field.name); | 3236 | die("field %s not found", arg->field.name); |
3237 | arg->field.field = field; | ||
3235 | } | 3238 | } |
3236 | /* Zero sized fields, mean the rest of the data */ | 3239 | /* Zero sized fields, mean the rest of the data */ |
3237 | len = arg->field.field->size ? : size - arg->field.field->offset; | 3240 | len = field->size ? : size - field->offset; |
3238 | 3241 | ||
3239 | /* | 3242 | /* |
3240 | * Some events pass in pointers. If this is not an array | 3243 | * Some events pass in pointers. If this is not an array |
3241 | * and the size is the same as long_size, assume that it | 3244 | * and the size is the same as long_size, assume that it |
3242 | * is a pointer. | 3245 | * is a pointer. |
3243 | */ | 3246 | */ |
3244 | if (!(arg->field.field->flags & FIELD_IS_ARRAY) && | 3247 | if (!(field->flags & FIELD_IS_ARRAY) && |
3245 | arg->field.field->size == pevent->long_size) { | 3248 | field->size == pevent->long_size) { |
3246 | addr = *(unsigned long *)(data + arg->field.field->offset); | 3249 | addr = *(unsigned long *)(data + field->offset); |
3247 | trace_seq_printf(s, "%lx", addr); | 3250 | trace_seq_printf(s, "%lx", addr); |
3248 | break; | 3251 | break; |
3249 | } | 3252 | } |
3250 | str = malloc_or_die(len + 1); | 3253 | str = malloc_or_die(len + 1); |
3251 | memcpy(str, data + arg->field.field->offset, len); | 3254 | memcpy(str, data + field->offset, len); |
3252 | str[len] = 0; | 3255 | str[len] = 0; |
3253 | print_str_to_seq(s, format, len_arg, str); | 3256 | print_str_to_seq(s, format, len_arg, str); |
3254 | free(str); | 3257 | free(str); |