Commit adf365f4 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Ingo Molnar

perf probe: Use strlist__for_each macros in probe-event.c

Use strlist__for_each macros instead of using strlist__entry()
and index variable.
Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Frank Ch. Eigler <fche@redhat.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: K.Prasad <prasad@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20091215153203.17436.52039.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent abf5ef72
...@@ -404,7 +404,6 @@ static void show_perf_probe_event(const char *group, const char *event, ...@@ -404,7 +404,6 @@ static void show_perf_probe_event(const char *group, const char *event,
/* List up current perf-probe events */ /* List up current perf-probe events */
void show_perf_probe_events(void) void show_perf_probe_events(void)
{ {
unsigned int i;
int fd, nr; int fd, nr;
char *group, *event; char *group, *event;
struct probe_point pp; struct probe_point pp;
...@@ -415,8 +414,7 @@ void show_perf_probe_events(void) ...@@ -415,8 +414,7 @@ void show_perf_probe_events(void)
rawlist = get_trace_kprobe_event_rawlist(fd); rawlist = get_trace_kprobe_event_rawlist(fd);
close(fd); close(fd);
for (i = 0; i < strlist__nr_entries(rawlist); i++) { strlist__for_each(ent, rawlist) {
ent = strlist__entry(rawlist, i);
parse_trace_kprobe_event(ent->s, &group, &event, &pp); parse_trace_kprobe_event(ent->s, &group, &event, &pp);
/* Synthesize only event probe point */ /* Synthesize only event probe point */
nr = pp.nr_args; nr = pp.nr_args;
...@@ -436,7 +434,6 @@ void show_perf_probe_events(void) ...@@ -436,7 +434,6 @@ void show_perf_probe_events(void)
/* Get current perf-probe event names */ /* Get current perf-probe event names */
static struct strlist *get_perf_event_names(int fd, bool include_group) static struct strlist *get_perf_event_names(int fd, bool include_group)
{ {
unsigned int i;
char *group, *event; char *group, *event;
char buf[128]; char buf[128];
struct strlist *sl, *rawlist; struct strlist *sl, *rawlist;
...@@ -445,8 +442,7 @@ static struct strlist *get_perf_event_names(int fd, bool include_group) ...@@ -445,8 +442,7 @@ static struct strlist *get_perf_event_names(int fd, bool include_group)
rawlist = get_trace_kprobe_event_rawlist(fd); rawlist = get_trace_kprobe_event_rawlist(fd);
sl = strlist__new(true, NULL); sl = strlist__new(true, NULL);
for (i = 0; i < strlist__nr_entries(rawlist); i++) { strlist__for_each(ent, rawlist) {
ent = strlist__entry(rawlist, i);
parse_trace_kprobe_event(ent->s, &group, &event, NULL); parse_trace_kprobe_event(ent->s, &group, &event, NULL);
if (include_group) { if (include_group) {
if (e_snprintf(buf, 128, "%s:%s", group, event) < 0) if (e_snprintf(buf, 128, "%s:%s", group, event) < 0)
...@@ -561,7 +557,6 @@ static void del_trace_kprobe_event(int fd, const char *group, ...@@ -561,7 +557,6 @@ static void del_trace_kprobe_event(int fd, const char *group,
void del_trace_kprobe_events(struct strlist *dellist) void del_trace_kprobe_events(struct strlist *dellist)
{ {
int fd; int fd;
unsigned int i;
const char *group, *event; const char *group, *event;
char *p, *str; char *p, *str;
struct str_node *ent; struct str_node *ent;
...@@ -571,8 +566,7 @@ void del_trace_kprobe_events(struct strlist *dellist) ...@@ -571,8 +566,7 @@ void del_trace_kprobe_events(struct strlist *dellist)
/* Get current event names */ /* Get current event names */
namelist = get_perf_event_names(fd, true); namelist = get_perf_event_names(fd, true);
for (i = 0; i < strlist__nr_entries(dellist); i++) { strlist__for_each(ent, dellist) {
ent = strlist__entry(dellist, i);
str = strdup(ent->s); str = strdup(ent->s);
if (!str) if (!str)
die("Failed to copy event."); die("Failed to copy event.");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment