Skip to content

Commit

Permalink
perf events parse: Remove some needless local variables
Browse files Browse the repository at this point in the history
Those are just casting a void pointer to a struct to then pass them to
functions, i.e. remove the local variables and pass the void pointer
directly, the casting will be done and the code will be shorter.

Cc: Adrian Hunter <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Wang Nan <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Aug 17, 2017
1 parent d6d4fc6 commit 07806a1
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions tools/perf/util/parse-events.y
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,13 @@ event_def: event_pmu |
event_pmu:
PE_NAME opt_event_config
{
struct parse_events_evlist *data = _data;
struct list_head *list, *orig_terms, *terms;

if (parse_events_copy_term_list($2, &orig_terms))
YYABORT;

ALLOC_LIST(list);
if (parse_events_add_pmu(data, list, $1, $2)) {
if (parse_events_add_pmu(_data, list, $1, $2)) {
struct perf_pmu *pmu = NULL;
int ok = 0;

Expand All @@ -245,7 +244,7 @@ PE_NAME opt_event_config
if (!strncmp($1, name, strlen($1))) {
if (parse_events_copy_term_list(orig_terms, &terms))
YYABORT;
if (!parse_events_add_pmu(data, list, pmu->name, terms))
if (!parse_events_add_pmu(_data, list, pmu->name, terms))
ok++;
parse_events_terms__delete(terms);
}
Expand Down Expand Up @@ -286,26 +285,24 @@ PE_VALUE_SYM_SW
event_legacy_symbol:
value_sym '/' event_config '/'
{
struct parse_events_evlist *data = _data;
struct list_head *list;
int type = $1 >> 16;
int config = $1 & 255;

ALLOC_LIST(list);
ABORT_ON(parse_events_add_numeric(data, list, type, config, $3));
ABORT_ON(parse_events_add_numeric(_data, list, type, config, $3));
parse_events_terms__delete($3);
$$ = list;
}
|
value_sym sep_slash_dc
{
struct parse_events_evlist *data = _data;
struct list_head *list;
int type = $1 >> 16;
int config = $1 & 255;

ALLOC_LIST(list);
ABORT_ON(parse_events_add_numeric(data, list, type, config, NULL));
ABORT_ON(parse_events_add_numeric(_data, list, type, config, NULL));
$$ = list;
}

Expand Down Expand Up @@ -432,23 +429,21 @@ PE_NAME ':' PE_NAME
event_legacy_numeric:
PE_VALUE ':' PE_VALUE opt_event_config
{
struct parse_events_evlist *data = _data;
struct list_head *list;

ALLOC_LIST(list);
ABORT_ON(parse_events_add_numeric(data, list, (u32)$1, $3, $4));
ABORT_ON(parse_events_add_numeric(_data, list, (u32)$1, $3, $4));
parse_events_terms__delete($4);
$$ = list;
}

event_legacy_raw:
PE_RAW opt_event_config
{
struct parse_events_evlist *data = _data;
struct list_head *list;

ALLOC_LIST(list);
ABORT_ON(parse_events_add_numeric(data, list, PERF_TYPE_RAW, $1, $2));
ABORT_ON(parse_events_add_numeric(_data, list, PERF_TYPE_RAW, $1, $2));
parse_events_terms__delete($2);
$$ = list;
}
Expand All @@ -468,11 +463,10 @@ PE_BPF_OBJECT opt_event_config
|
PE_BPF_SOURCE opt_event_config
{
struct parse_events_evlist *data = _data;
struct list_head *list;

ALLOC_LIST(list);
ABORT_ON(parse_events_load_bpf(data, list, $1, true, $2));
ABORT_ON(parse_events_load_bpf(_data, list, $1, true, $2));
parse_events_terms__delete($2);
$$ = list;
}
Expand Down

0 comments on commit 07806a1

Please sign in to comment.