aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-06-18 12:29:06 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-06-18 12:29:06 -0400
commit1d2b4fa4f4f2d5359cb7ca83c7ecc4bfacb6ac1e (patch)
tree33465b2d5bc81f8e58243b5a4a27cdcc5d5e8725
parent7a5047359ba0942219b7feaf923b520deee63496 (diff)
kernelshark: Remove the add_event() functions and use generic
Remove the custom add_event() and add_event_int() from trace-filter.c and use the tracecmd_add_id() generic routine. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-filter.c42
1 files changed, 6 insertions, 36 deletions
diff --git a/trace-filter.c b/trace-filter.c
index 25b71b6..ae856d3 100644
--- a/trace-filter.c
+++ b/trace-filter.c
@@ -1158,6 +1158,7 @@ create_tree_event_model(struct pevent *pevent,
1158 -1); 1158 -1);
1159 } 1159 }
1160 1160
1161 /* These are copies of the sets, using glib allocation */
1161 g_free(systems); 1162 g_free(systems);
1162 g_free(event_ids); 1163 g_free(event_ids);
1163 1164
@@ -1418,21 +1419,6 @@ trace_create_event_list_view(struct pevent *pevent,
1418 return view; 1419 return view;
1419} 1420}
1420 1421
1421static gint *add_event(gint *events, gint size, gint event)
1422{
1423 if (!events) {
1424 events = g_new0(gint, 2);
1425 size = 0;
1426 } else {
1427 events = g_realloc(events,
1428 sizeof(*events) * (size + 2));
1429 }
1430 events[size] = event;
1431 events[size+1] = -1;
1432
1433 return events;
1434}
1435
1436static gint update_events(GtkTreeModel *model, 1422static gint update_events(GtkTreeModel *model,
1437 GtkTreeIter *parent, 1423 GtkTreeIter *parent,
1438 gint **events, gint size) 1424 gint **events, gint size)
@@ -1452,7 +1438,7 @@ static gint update_events(GtkTreeModel *model,
1452 -1); 1438 -1);
1453 1439
1454 if (active) 1440 if (active)
1455 *events = add_event(*events, size++, id); 1441 *events = tracecmd_add_id(*events, id, size++);
1456 1442
1457 if (!gtk_tree_model_iter_next(model, &event)) 1443 if (!gtk_tree_model_iter_next(model, &event))
1458 break; 1444 break;
@@ -1546,7 +1532,7 @@ static void accept_events(GtkWidget *view,
1546 func(TRUE, all_events, systems, events, data); 1532 func(TRUE, all_events, systems, events, data);
1547 1533
1548 tracecmd_free_list(systems); 1534 tracecmd_free_list(systems);
1549 g_free(events); 1535 free(events);
1550} 1536}
1551 1537
1552static void filter_event_dialog(struct pevent *pevent, 1538static void filter_event_dialog(struct pevent *pevent,
@@ -1894,22 +1880,6 @@ void trace_filter_cpu_dialog(gboolean all_cpus, guint64 *cpus_selected, gint cpu
1894 destroy_cpu_helper(cpu_helper); 1880 destroy_cpu_helper(cpu_helper);
1895} 1881}
1896 1882
1897static void add_event_int(gint **events, gint event, int count)
1898{
1899 if (!events)
1900 return;
1901
1902 if (!count)
1903 *events = malloc_or_die(sizeof(gint) * 2);
1904 else
1905 *events = realloc(*events, sizeof(gint) * (count + 2));
1906 if (!*events)
1907 die("Can't allocate events");
1908
1909 (*events)[count] = event;
1910 (*events)[count+1] = -1;
1911}
1912
1913/* -- Helper functions -- */ 1883/* -- Helper functions -- */
1914 1884
1915/** 1885/**
@@ -1959,11 +1929,11 @@ void trace_filter_convert_filter_to_names(struct event_filter *filter,
1959 if (pevent_filter_event_has_trivial(filter, event->id, 1929 if (pevent_filter_event_has_trivial(filter, event->id,
1960 FILTER_TRIVIAL_TRUE)) { 1930 FILTER_TRIVIAL_TRUE)) {
1961 if (!all_selected || !systems) 1931 if (!all_selected || !systems)
1962 add_event_int(event_ids, event->id, event_count++); 1932 *event_ids = tracecmd_add_id(*event_ids, event->id, event_count++);
1963 } else { 1933 } else {
1964 if (all_selected && event_ids) { 1934 if (all_selected && event_ids) {
1965 for (x = start_sys; x < i; x++) { 1935 for (x = start_sys; x < i; x++) {
1966 add_event_int(event_ids, 1936 *event_ids = tracecmd_add_id(*event_ids,
1967 events[x]->id, event_count++); 1937 events[x]->id, event_count++);
1968 } 1938 }
1969 } 1939 }
@@ -1971,7 +1941,7 @@ void trace_filter_convert_filter_to_names(struct event_filter *filter,
1971 1941
1972 /* If this event is filtered, still add it */ 1942 /* If this event is filtered, still add it */
1973 if (pevent_event_filtered(filter, event->id)) 1943 if (pevent_event_filtered(filter, event->id))
1974 add_event_int(event_ids, event->id, event_count++); 1944 *event_ids = tracecmd_add_id(*event_ids, event->id, event_count++);
1975 } 1945 }
1976 last_system = event->system; 1946 last_system = event->system;
1977 } 1947 }