Skip to contentSkip to conversation

kernel-shark-qt: Move declarations to top in datafilter.c example

PATCH In review Steven Rostedt 1 participant 1 message Jul 3, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 kernel-shark-qt: Move declarations to top in datafilter.c example

From: "Steven Rostedt (VMware)" <[email protected]>

The C style for trace-cmd and KernelShark is to follow the Linux kernel where all declarations are done at a top of a C block and not intermingled in the code.

---
 kernel-shark-qt/examples/datafilter.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
kernel-shark-qt/examples/datafilter.c +3 -2
index f8048bf62d32..13b088ebdc20 100644
@@ -18,6 +18,8 @@ int main(int argc, char **argv)
 	size_t i, n_rows, n_tasks, n_evts, count;
 	struct kshark_context *kshark_ctx;
 	struct kshark_entry **data = NULL;
+	struct event_filter *adv_filter;
+	struct event_format *event;
 	char *entry_str;
 	bool status;
 	int *pids;
@@ -81,7 +83,6 @@ int main(int argc, char **argv)
 	puts("\n\n");
 
 	/* Show only "sched" events. */
-	struct event_format *event;
 	n_evts = kshark_ctx->pevent->nr_events;
 	for (i = 0; i < n_evts; ++i) {
 		event = kshark_ctx->pevent->events[i];
@@ -115,7 +116,7 @@ int main(int argc, char **argv)
 	kshark_filter_clear(kshark_ctx, KS_SHOW_EVENT_FILTER);
 
 	/* Use the Advanced filter to do event content based filtering. */
-	struct event_filter *adv_filter = kshark_ctx->advanced_event_filter;
+	adv_filter = kshark_ctx->advanced_event_filter;
 	pevent_filter_add_filter_str(adv_filter,
 				     "sched/sched_wakeup:target_cpu==1");
 
Signature · 1 line
2.17.1