From 8f31828398b8a4fcdb679324291132f4f0e3dce6 Mon Sep 17 00:00:00 2001 From: Benjamin Poirier Date: Mon, 19 Oct 2009 15:33:02 -0400 Subject: [PATCH] Move "active" code out of debug statements Certain g_assert() statements contained expressions that modify the rest of the program state (eg. modifying variables). As stated in the GLib reference, g_assert() is a macro that can be compiled out. This would change the behavior of an otherwise correct lttv. Signed-off-by: Benjamin Poirier --- lttv/lttv/attribute.c | 13 +- lttv/lttv/batchtest.c | 49 +++-- lttv/lttv/filter.c | 3 +- lttv/lttv/main.c | 21 +- lttv/lttv/state.c | 6 +- lttv/lttv/tracecontext.c | 12 +- lttv/modules/gui/controlflow/drawitem.c | 6 +- lttv/modules/gui/detailedevents/events.c | 4 +- lttv/modules/gui/histogram/histodrawitem.c | 6 +- .../gui/lttvwindow/lttvwindow/callbacks.c | 74 ++++--- .../gui/lttvwindow/lttvwindow/init_module.c | 6 +- .../gui/lttvwindow/lttvwindow/lttvwindow.c | 205 ++++++++++++------ lttv/modules/gui/resourceview/drawitem.c | 6 +- lttv/modules/text/batchAnalysis.c | 52 +++-- lttv/modules/text/precomputeState.c | 26 ++- lttv/modules/text/textFilter.c | 27 ++- 16 files changed, 341 insertions(+), 175 deletions(-) diff --git a/lttv/lttv/attribute.c b/lttv/lttv/attribute.c index 9966b448..7ba8f2c5 100644 --- a/lttv/lttv/attribute.c +++ b/lttv/lttv/attribute.c @@ -339,6 +339,7 @@ void lttv_attribute_recursive_add(LttvAttribute *dest, LttvAttribute *src) Attribute *a; LttvAttributeValue value; + gboolean retval; nb = src->attributes->len; @@ -355,10 +356,14 @@ void lttv_attribute_recursive_add(LttvAttribute *dest, LttvAttribute *src) dest, a->name), (LttvAttribute *)(a->value.dv_gobject)); } else { - if(a->is_named) - g_assert(lttv_attribute_find(dest, a->name, a->type, &value)); - else - g_assert(lttv_attribute_find_unnamed(dest, a->name, a->type, &value)); + if(a->is_named) { + retval= lttv_attribute_find(dest, a->name, a->type, &value); + g_assert(retval); + } + else { + retval= lttv_attribute_find_unnamed(dest, a->name, a->type, &value); + g_assert(retval); + } switch(a->type) { case LTTV_INT: *value.v_int += a->value.dv_int; diff --git a/lttv/lttv/batchtest.c b/lttv/lttv/batchtest.c index be60bb41..3dd7725e 100644 --- a/lttv/lttv/batchtest.c +++ b/lttv/lttv/batchtest.c @@ -801,6 +801,7 @@ static void init() LttvAttributeValue value; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); + gboolean retval; g_info("Init batchtest.c"); @@ -915,35 +916,43 @@ static void init() event_hook = lttv_hooks_new(); - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/traceset/before", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = before_traceset; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/after", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/traceset/after", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = after_traceset; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/trace/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/trace/before", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = before_trace; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/trace/after", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/trace/after", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = after_trace; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/tracefile/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/tracefile/before", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = before_tracefile; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/tracefile/after", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/tracefile/after", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = after_tracefile; - //g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/before", - // LTTV_POINTER, &value)); + //retval= lttv_iattribute_find_by_path(attributes, "hooks/event/before", + // LTTV_POINTER, &value); //*(value.v_pointer) = before_event; - //g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/after", - // LTTV_POINTER, &value)); + //retval= lttv_iattribute_find_by_path(attributes, "hooks/event/after", + // LTTV_POINTER, &value); //*(value.v_pointer) = after_event; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/event", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = event_hook; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/main/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/main/before", + LTTV_POINTER, &value); + g_assert(retval); g_assert((main_hooks = *(value.v_pointer)) != NULL); lttv_hooks_add(main_hooks, process_traceset, NULL, LTTV_PRIO_DEFAULT); } diff --git a/lttv/lttv/filter.c b/lttv/lttv/filter.c index 28252b31..fa5a1559 100644 --- a/lttv/lttv/filter.c +++ b/lttv/lttv/filter.c @@ -137,7 +137,8 @@ lttv_simple_expression_assign_field(GPtrArray* fp, LttvSimpleExpression* se) { GString* f = NULL; if(fp->len < 2) return FALSE; - g_assert((f=ltt_g_ptr_array_remove_index_slow(fp,0))); + f=ltt_g_ptr_array_remove_index_slow(fp,0); + g_assert(f); /* diff --git a/lttv/lttv/main.c b/lttv/lttv/main.c index eca23438..e894ac18 100644 --- a/lttv/lttv/main.c +++ b/lttv/lttv/main.c @@ -95,6 +95,7 @@ int main(int argc, char **argv) *profile_memory_long_option = "--memory"; gboolean profile_memory = FALSE; + gboolean retval; LttvAttributeValue value; @@ -136,17 +137,21 @@ int main(int argc, char **argv) /* Create a number of hooks lists */ - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/options/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/options/before", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = before_options; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/options/after", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/options/after", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = after_options; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/main/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/main/before", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = before_main; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/main/after", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/main/after", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = after_main; diff --git a/lttv/lttv/state.c b/lttv/lttv/state.c index 1a245500..d65ee57f 100644 --- a/lttv/lttv/state.c +++ b/lttv/lttv/state.c @@ -1707,6 +1707,7 @@ static void state_restore(LttvTraceState *self, LttvAttribute *container) LttEventPosition *ep; LttvTracesetContext *tsc = self->parent.ts_context; + int retval; tracefiles_tree = lttv_attribute_find_subdir(container, LTTV_STATE_TRACEFILES); @@ -1794,9 +1795,10 @@ static void state_restore(LttvTraceState *self, LttvAttribute *container) g_tree_remove(tsc->pqueue, tfc); if(ep != NULL) { - g_assert(ltt_tracefile_seek_position(tfc->tf, ep) == 0); + retval= ltt_tracefile_seek_position(tfc->tf, ep); + g_assert_cmpint(retval, ==, 0); tfc->timestamp = ltt_event_time(ltt_tracefile_get_event(tfc->tf)); - g_assert(ltt_time_compare(tfc->timestamp, ltt_time_infinite) != 0); + g_assert_cmpint(ltt_time_compare(tfc->timestamp, ltt_time_infinite), !=, 0); g_tree_insert(tsc->pqueue, tfc, tfc); g_info("Restoring state for a tf at time %lu.%lu", tfc->timestamp.tv_sec, tfc->timestamp.tv_nsec); } else { diff --git a/lttv/lttv/tracecontext.c b/lttv/lttv/tracecontext.c index 710cdecb..0166e9e3 100644 --- a/lttv/lttv/tracecontext.c +++ b/lttv/lttv/tracecontext.c @@ -1287,7 +1287,10 @@ LttvTracefileContext *lttv_traceset_context_get_current_tfc(LttvTracesetContext */ void lttv_process_traceset_synchronize_tracefiles(LttvTracesetContext *tsc) { - g_assert(lttv_process_traceset_seek_position(tsc, tsc->sync_position) == 0); + int retval; + + retval= lttv_process_traceset_seek_position(tsc, tsc->sync_position); + g_assert_cmpint(retval, ==, 0); } @@ -1414,6 +1417,7 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self, LttTime time_offset; struct seek_back_data sd; LttvHooks *hooks = lttv_hooks_new(); + int retval; sd.first_event = 0; sd.events_found = 0; @@ -1506,11 +1510,13 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self, LttvTracesetContextPosition *pos = (LttvTracesetContextPosition*)g_ptr_array_index (sd.array, sd.first_event); - g_assert(lttv_process_traceset_seek_position(self, pos) == 0); + retval= lttv_process_traceset_seek_position(self, pos); + g_assert_cmpint(retval, ==, 0); } else { /* Will seek to the last saved position : in the worst case, it will be the * original position (if events_found is 0) */ - g_assert(lttv_process_traceset_seek_position(self, saved_pos) == 0); + retval= lttv_process_traceset_seek_position(self, saved_pos); + g_assert_cmpint(retval, ==, 0); } for(i=0;ilen;i++) { diff --git a/lttv/modules/gui/controlflow/drawitem.c b/lttv/modules/gui/controlflow/drawitem.c index d97628b0..cdeedda0 100644 --- a/lttv/modules/gui/controlflow/drawitem.c +++ b/lttv/modules/gui/controlflow/drawitem.c @@ -214,6 +214,7 @@ gboolean draw_icon( void *hook_data, void *call_data) { PropertiesIcon *properties = (PropertiesIcon*)hook_data; DrawContext *draw_context = (DrawContext*)call_data; + gboolean retval; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); LttvAttributeValue value; @@ -222,8 +223,9 @@ gboolean draw_icon( void *hook_data, void *call_data) strcat(icon_name, properties->icon_name); - g_assert(lttv_iattribute_find_by_path(attributes, icon_name, - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, icon_name, LTTV_POINTER, + &value); + g_assert(retval); if(unlikely(*(value.v_pointer) == NULL)) { *(value.v_pointer) = icon_info = g_new(IconStruct,1); diff --git a/lttv/modules/gui/detailedevents/events.c b/lttv/modules/gui/detailedevents/events.c index 22bb4208..7c9b66ac 100644 --- a/lttv/modules/gui/detailedevents/events.c +++ b/lttv/modules/gui/detailedevents/events.c @@ -1310,6 +1310,7 @@ static void get_events(double new_value, EventViewerData *event_viewer_data) LttvTracesetContext *tsc = (LttvTracesetContext*)tss; guint i; gboolean seek_by_time; + int retval; if(lttvwindow_preempt_count > 0) return; @@ -1398,7 +1399,8 @@ static void get_events(double new_value, EventViewerData *event_viewer_data) pos); } else if(relative_position < 0) { - g_assert(lttv_process_traceset_seek_position(tsc, pos) == 0); + retval= lttv_process_traceset_seek_position(tsc, pos); + g_assert_cmpint(retval, ==, 0); } } else { /* There is nothing in the list : simply seek to the time value. */ diff --git a/lttv/modules/gui/histogram/histodrawitem.c b/lttv/modules/gui/histogram/histodrawitem.c index aafa515d..73bd3edf 100644 --- a/lttv/modules/gui/histogram/histodrawitem.c +++ b/lttv/modules/gui/histogram/histodrawitem.c @@ -213,6 +213,7 @@ gboolean histo_draw_icon( void *hook_data, void *call_data) { histo_PropertiesIcon *properties = (histo_PropertiesIcon*)hook_data; histo_DrawContext *draw_context = (histo_DrawContext*)call_data; + gboolean retval; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); LttvAttributeValue value; @@ -221,8 +222,9 @@ gboolean histo_draw_icon( void *hook_data, void *call_data) strcat(icon_name, properties->icon_name); - g_assert(lttv_iattribute_find_by_path(attributes, icon_name, - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, icon_name, + LTTV_POINTER, &value); + g_assert(retval); if(unlikely(*(value.v_pointer) == NULL)) { *(value.v_pointer) = icon_info = g_new(histo_IconStruct,1); diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 0b5756e9..565cec17 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -553,8 +553,9 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) gint retval = 0; - g_assert( lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatetraceset", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatetraceset", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL) retval = 1; @@ -603,8 +604,11 @@ void update_traceset(Tab *tab) { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatetraceset", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatetraceset", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL) return; lttv_hooks_call(tmp, NULL); @@ -2100,6 +2104,8 @@ void redraw(GtkWidget *widget, gpointer user_data) GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook))); Tab *tab; + gboolean retval; + if(!page) { return; } else { @@ -2111,7 +2117,8 @@ void redraw(GtkWidget *widget, gpointer user_data) LttvHooks * tmp; LttvAttributeValue value; - g_assert(lttv_iattribute_find_by_path(tab->attributes, "hooks/redraw", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/redraw", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp != NULL) @@ -2125,6 +2132,8 @@ void continue_processing(GtkWidget *widget, gpointer user_data) GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook))); Tab *tab; + gboolean retval; + if(!page) { return; } else { @@ -2136,8 +2145,9 @@ void continue_processing(GtkWidget *widget, gpointer user_data) LttvHooks * tmp; LttvAttributeValue value; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/continue", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/continue", + LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp != NULL) @@ -3307,17 +3317,20 @@ on_MWindow_destroy (GtkWidget *widget, MainWindow *main_window = get_window_data_struct(widget); LttvIAttribute *attributes = main_window->attributes; LttvAttributeValue value; + gboolean retval; //This is unnecessary, since widgets will be destroyed //by the main window widget anyway. //remove_all_menu_toolbar_constructors(main_window, NULL); - g_assert(lttv_iattribute_find_by_path(attributes, - "viewers/menu", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "viewers/menu", + LTTV_POINTER, &value); + g_assert(retval); lttv_menus_destroy((LttvMenus*)*(value.v_pointer)); - g_assert(lttv_iattribute_find_by_path(attributes, - "viewers/toolbar", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "viewers/toolbar", + LTTV_POINTER, &value); + g_assert(retval); lttv_toolbars_destroy((LttvToolbars*)*(value.v_pointer)); g_object_unref(main_window->attributes); @@ -3914,8 +3927,10 @@ void current_position_change_manager(Tab *tab, LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); TimeInterval time_span = tsc->time_span; + int retval; - g_assert(lttv_process_traceset_seek_position(tsc, pos) == 0); + retval= lttv_process_traceset_seek_position(tsc, pos); + g_assert_cmpint(retval, ==, 0); LttTime new_time = lttv_traceset_context_position_get_time(pos); /* Put the context in a state coherent position */ lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc, ltt_time_zero); @@ -4170,29 +4185,32 @@ void add_all_menu_toolbar_constructors(MainWindow * mw, gpointer user_data) LttvIAttribute *global_attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); LttvIAttribute *attributes = mw->attributes; GtkWidget * tool_menu_title_menu, *new_widget, *pixmap; + gboolean retval; - g_assert(lttv_iattribute_find_by_path(global_attributes, - "viewers/menu", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(global_attributes, "viewers/menu", + LTTV_POINTER, &value); + g_assert(retval); if(*(value.v_pointer) == NULL) *(value.v_pointer) = lttv_menus_new(); global_menu = (LttvMenus*)*(value.v_pointer); - g_assert(lttv_iattribute_find_by_path(attributes, - "viewers/menu", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "viewers/menu", + LTTV_POINTER, &value); + g_assert(retval); if(*(value.v_pointer) == NULL) *(value.v_pointer) = lttv_menus_new(); instance_menu = (LttvMenus*)*(value.v_pointer); - - - g_assert(lttv_iattribute_find_by_path(global_attributes, - "viewers/toolbar", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(global_attributes, "viewers/toolbar", + LTTV_POINTER, &value); + g_assert(retval); if(*(value.v_pointer) == NULL) *(value.v_pointer) = lttv_toolbars_new(); global_toolbar = (LttvToolbars*)*(value.v_pointer); - g_assert(lttv_iattribute_find_by_path(attributes, - "viewers/toolbar", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "viewers/toolbar", + LTTV_POINTER, &value); + g_assert(retval); if(*(value.v_pointer) == NULL) *(value.v_pointer) = lttv_toolbars_new(); instance_toolbar = (LttvToolbars*)*(value.v_pointer); @@ -4262,6 +4280,8 @@ void add_all_menu_toolbar_constructors(MainWindow * mw, gpointer user_data) MainWindow *construct_main_window(MainWindow * parent) { + gboolean retval; + g_debug("construct_main_window()"); GtkWidget * new_window; /* New generated main window */ MainWindow * new_m_window;/* New main window structure */ @@ -4282,12 +4302,14 @@ MainWindow *construct_main_window(MainWindow * parent) new_m_window->mwindow = new_window; new_m_window->attributes = attributes; - g_assert(lttv_iattribute_find_by_path(attributes, - "viewers/menu", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "viewers/menu", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = lttv_menus_new(); - g_assert(lttv_iattribute_find_by_path(attributes, - "viewers/toolbar", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "viewers/toolbar", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = lttv_toolbars_new(); add_all_menu_toolbar_constructors(new_m_window, NULL); diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c b/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c index 83d35c96..7689aa32 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c @@ -134,6 +134,7 @@ static gboolean window_creation_hook(void *hook_data, void *call_data) static void init() { LttvAttributeValue value; + gboolean retval; // Global attributes only used for interaction with main() here. LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); @@ -173,8 +174,9 @@ static void init() { "pathname of the directory containing the trace", LTTV_OPT_STRING, &a_trace, lttv_trace_option, NULL); - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/main/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/main/before", + LTTV_POINTER, &value); + g_assert(retval); g_assert((main_hooks = *(value.v_pointer)) != NULL); lttv_hooks_add(main_hooks, window_creation_hook, NULL, LTTV_PRIO_DEFAULT); diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c index ebbaa06f..d4860208 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -65,6 +65,7 @@ void set_time_window(Tab *tab, const TimeWindow *time_window) { LttvAttributeValue value; LttvHooks * tmp; + gboolean retval; TimeWindowNotifyData time_window_notify_data; TimeWindow old_time_window = tab->time_window; @@ -73,8 +74,9 @@ void set_time_window(Tab *tab, const TimeWindow *time_window) time_window_notify_data.new_time_window = &(tab->time_window); - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatetimewindow", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatetimewindow", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp != NULL) lttv_hooks_call(tmp, &time_window_notify_data); @@ -94,11 +96,13 @@ void set_current_time(Tab *tab, const LttTime *current_time) { LttvAttributeValue value; LttvHooks * tmp; + gboolean retval; tab->current_time = *current_time; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatecurrenttime", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatecurrenttime", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp != NULL) lttv_hooks_call(tmp, &tab->current_time); } @@ -115,11 +119,13 @@ void set_current_position(Tab *tab, const LttvTracesetContextPosition *pos) { LttvAttributeValue value; LttvHooks * tmp; + gboolean retval; tab->current_time = lttv_traceset_context_position_get_time(pos); - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatecurrentposition", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatecurrentposition", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp != NULL) lttv_hooks_call(tmp, pos); } @@ -132,9 +138,11 @@ void add_toolbar_constructor(MainWindow *mw, LttvToolbarClosure *toolbar_c) lttvwindow_viewer_constructor constructor; GtkWidget * tool_menu_title_menu, *new_widget, *pixmap; GdkPixbuf *pixbuf; + gboolean retval; - g_assert(lttv_iattribute_find_by_path(attributes, - "viewers/toolbar", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "viewers/toolbar", + LTTV_POINTER, &value); + g_assert(retval); if(*(value.v_pointer) == NULL) *(value.v_pointer) = lttv_toolbars_new(); instance_toolbar = (LttvToolbars*)*(value.v_pointer); @@ -176,9 +184,11 @@ void add_menu_constructor(MainWindow *mw, LttvMenuClosure *menu_c) LttvToolbars * instance_menu; lttvwindow_viewer_constructor constructor; GtkWidget * tool_menu_title_menu, *new_widget; + gboolean retval; - g_assert(lttv_iattribute_find_by_path(attributes, - "viewers/menu", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "viewers/menu", + LTTV_POINTER, &value); + g_assert(retval); if(*(value.v_pointer) == NULL) *(value.v_pointer) = lttv_menus_new(); instance_menu = (LttvMenus*)*(value.v_pointer); @@ -206,9 +216,11 @@ void remove_toolbar_constructor(MainWindow *mw, lttvwindow_viewer_constructor vi LttvAttributeValue value; LttvToolbars * instance_toolbar; GtkWidget * tool_menu_title_menu, *widget; + gboolean retval; - g_assert(lttv_iattribute_find_by_path(attributes, - "viewers/toolbar", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "viewers/toolbar", + LTTV_POINTER, &value); + g_assert(retval); if(*(value.v_pointer) == NULL) *(value.v_pointer) = lttv_toolbars_new(); instance_toolbar = (LttvToolbars*)*(value.v_pointer); @@ -226,9 +238,11 @@ void remove_menu_constructor(MainWindow *mw, lttvwindow_viewer_constructor viewe LttvAttributeValue value; LttvMenus * instance_menu; GtkWidget * tool_menu_title_menu, *widget; + gboolean retval; - g_assert(lttv_iattribute_find_by_path(attributes, - "viewers/menu", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "viewers/menu", + LTTV_POINTER, &value); + g_assert(retval); if(*(value.v_pointer) == NULL) *(value.v_pointer) = lttv_menus_new(); instance_menu = (LttvMenus*)*(value.v_pointer); @@ -274,12 +288,14 @@ __EXPORT void lttvwindow_register_constructor LttvToolbarClosure toolbar_c; LttvMenuClosure menu_c; LttvAttributeValue value; + gboolean retval; if(view_constructor == NULL) return; if(pixmap != NULL) { - g_assert(lttv_iattribute_find_by_path(attributes_global, - "viewers/toolbar", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes_global, "viewers/toolbar", + LTTV_POINTER, &value); + g_assert(retval); toolbar = (LttvToolbars*)*(value.v_pointer); if(toolbar == NULL) { @@ -295,8 +311,9 @@ __EXPORT void lttvwindow_register_constructor } if(menu_path != NULL) { - g_assert(lttv_iattribute_find_by_path(attributes_global, - "viewers/menu", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes_global, "viewers/menu", + LTTV_POINTER, &value); + g_assert(retval); menu = (LttvMenus*)*(value.v_pointer); if(menu == NULL) { @@ -346,10 +363,12 @@ __EXPORT void lttvwindow_unregister_constructor LttvToolbars * toolbar; LttvMenus * menu; LttvAttributeValue value; - gboolean is_named; + gboolean is_named; + gboolean retval; - g_assert(lttv_iattribute_find_by_path(attributes_global, - "viewers/toolbar", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes_global, "viewers/toolbar", + LTTV_POINTER, &value); + g_assert(retval); toolbar = (LttvToolbars*)*(value.v_pointer); if(toolbar != NULL) { @@ -359,8 +378,9 @@ __EXPORT void lttvwindow_unregister_constructor lttv_toolbars_remove(toolbar, view_constructor); } - g_assert(lttv_iattribute_find_by_path(attributes_global, - "viewers/menu", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes_global, "viewers/menu", + LTTV_POINTER, &value); + g_assert(retval); menu = (LttvMenus*)*(value.v_pointer); if(menu != NULL) { @@ -408,8 +428,11 @@ __EXPORT void lttvwindow_register_time_window_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatetimewindow", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatetimewindow", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL){ tmp = lttv_hooks_new(); @@ -432,8 +455,11 @@ __EXPORT void lttvwindow_unregister_time_window_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatetimewindow", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatetimewindow", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL) return; lttv_hooks_remove_data(tmp, hook, hook_data); @@ -452,8 +478,11 @@ __EXPORT void lttvwindow_register_traceset_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatetraceset", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatetraceset", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL){ tmp = lttv_hooks_new(); @@ -476,8 +505,11 @@ __EXPORT void lttvwindow_unregister_traceset_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatetraceset", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatetraceset", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL) return; lttv_hooks_remove_data(tmp, hook, hook_data); @@ -496,8 +528,11 @@ __EXPORT void lttvwindow_register_redraw_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/redraw", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/redraw", + LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL){ tmp = lttv_hooks_new(); @@ -520,8 +555,11 @@ __EXPORT void lttvwindow_unregister_redraw_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/redraw", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/redraw", + LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL) return; lttv_hooks_remove_data(tmp, hook, hook_data); @@ -546,8 +584,11 @@ __EXPORT void lttvwindow_register_continue_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/continue", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/continue", + LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL){ tmp = lttv_hooks_new(); @@ -571,8 +612,11 @@ __EXPORT void lttvwindow_unregister_continue_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/continue", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/continue", + LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL) return; lttv_hooks_remove_data(tmp, hook, hook_data); @@ -592,8 +636,11 @@ __EXPORT void lttvwindow_register_filter_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatefilter", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/updatefilter", + LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL){ tmp = lttv_hooks_new(); @@ -617,8 +664,11 @@ __EXPORT void lttvwindow_unregister_filter_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatefilter", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/updatefilter", + LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL) return; lttv_hooks_remove_data(tmp, hook, hook_data); @@ -637,8 +687,11 @@ __EXPORT void lttvwindow_register_current_time_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatecurrenttime", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatecurrenttime", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL){ tmp = lttv_hooks_new(); @@ -661,8 +714,11 @@ __EXPORT void lttvwindow_unregister_current_time_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatecurrenttime", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatecurrenttime", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL) return; lttv_hooks_remove_data(tmp, hook, hook_data); @@ -681,8 +737,11 @@ __EXPORT void lttvwindow_register_current_position_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatecurrentposition", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatecurrentposition", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL){ tmp = lttv_hooks_new(); @@ -705,8 +764,11 @@ __EXPORT void lttvwindow_unregister_current_position_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatecurrentposition", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatecurrentposition", LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL) return; lttv_hooks_remove_data(tmp, hook, hook_data); @@ -726,8 +788,11 @@ void lttvwindow_register_show_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/showviewer", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/showviewer", + LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL){ tmp = lttv_hooks_new(); @@ -750,8 +815,11 @@ void lttvwindow_unregister_show_notify(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/showviewer", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/showviewer", + LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL) return; lttv_hooks_remove_data(tmp, hook, hook_data); @@ -770,8 +838,11 @@ void lttvwindow_register_dividor(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/hpanedividor", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/hpanedividor", + LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL){ tmp = lttv_hooks_new(); @@ -795,8 +866,11 @@ void lttvwindow_unregister_dividor(Tab *tab, { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/hpanedividor", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/hpanedividor", + LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL) return; lttv_hooks_remove_data(tmp, hook, hook_data); @@ -903,8 +977,11 @@ void lttvwindow_report_dividor(Tab *tab, gint position) { LttvAttributeValue value; LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/hpanedividor", LTTV_POINTER, &value)); + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/hpanedividor", + LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL) return; lttv_hooks_call(tmp, &position); @@ -1075,12 +1152,14 @@ void lttvwindow_report_filter(Tab *tab, LttvFilter *filter) { LttvAttributeValue value; LttvHooks * tmp; + gboolean retval; //lttv_filter_destroy(tab->filter); //tab->filter = filter; - g_assert(lttv_iattribute_find_by_path(tab->attributes, - "hooks/updatefilter", LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/updatefilter", + LTTV_POINTER, &value); + g_assert(retval); tmp = (LttvHooks*)*(value.v_pointer); if(tmp == NULL) return; lttv_hooks_call(tmp, filter); diff --git a/lttv/modules/gui/resourceview/drawitem.c b/lttv/modules/gui/resourceview/drawitem.c index d97628b0..5397f25b 100644 --- a/lttv/modules/gui/resourceview/drawitem.c +++ b/lttv/modules/gui/resourceview/drawitem.c @@ -219,11 +219,13 @@ gboolean draw_icon( void *hook_data, void *call_data) LttvAttributeValue value; gchar icon_name[MAX_PATH_LEN] = "icons/"; IconStruct *icon_info; + gboolean retval; strcat(icon_name, properties->icon_name); - g_assert(lttv_iattribute_find_by_path(attributes, icon_name, - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, icon_name, LTTV_POINTER, + &value); + g_assert(retval); if(unlikely(*(value.v_pointer) == NULL)) { *(value.v_pointer) = icon_info = g_new(IconStruct,1); diff --git a/lttv/modules/text/batchAnalysis.c b/lttv/modules/text/batchAnalysis.c index f78f3774..00286e2c 100644 --- a/lttv/modules/text/batchAnalysis.c +++ b/lttv/modules/text/batchAnalysis.c @@ -74,6 +74,7 @@ static gboolean process_traceset(void *hook_data, void *call_data) LttvTracesetContext *tc; LttTime start, end; + gboolean retval; g_info("BatchAnalysis begin process traceset"); @@ -91,11 +92,13 @@ static gboolean process_traceset(void *hook_data, void *call_data) lttv_state_add_event_hooks(tc); if(a_stats) lttv_stats_add_event_hooks(tscs); - g_assert(lttv_iattribute_find_by_path(attributes, "filter/expression", - LTTV_POINTER, &value_expression)); + retval= lttv_iattribute_find_by_path(attributes, "filter/expression", + LTTV_POINTER, &value_expression); + g_assert(retval); - g_assert(lttv_iattribute_find_by_path(attributes, "filter/lttv_filter", - LTTV_POINTER, &value_filter)); + retval= lttv_iattribute_find_by_path(attributes, "filter/lttv_filter", + LTTV_POINTER, &value_filter); + g_assert(retval); *(value_filter.v_pointer) = lttv_filter_new(); //g_debug("Filter string: %s",((GString*)*(value_expression.v_pointer))->str); @@ -157,6 +160,7 @@ static void init() LttvAttributeValue value; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); + gboolean retval; g_info("Init batchAnalysis.c"); @@ -184,23 +188,29 @@ static void init() //after_event = lttv_hooks_new(); event_hook = lttv_hooks_new(); - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/traceset/before", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = before_traceset; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/after", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/traceset/after", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = after_traceset; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/trace/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/trace/before", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = before_trace; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/trace/after", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/trace/after", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = after_trace; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/tracefile/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/tracefile/before", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = before_tracefile; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/tracefile/after", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/tracefile/after", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = after_tracefile; //g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/before", // LTTV_POINTER, &value)); @@ -208,12 +218,14 @@ static void init() //g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/after", // LTTV_POINTER, &value)); //*(value.v_pointer) = after_event; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/event", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = event_hook; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/main/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/main/before", + LTTV_POINTER, &value); + g_assert(retval); g_assert((main_hooks = *(value.v_pointer)) != NULL); lttv_hooks_add(main_hooks, process_traceset, NULL, LTTV_PRIO_DEFAULT); } diff --git a/lttv/modules/text/precomputeState.c b/lttv/modules/text/precomputeState.c index f23937b9..a6e015b5 100644 --- a/lttv/modules/text/precomputeState.c +++ b/lttv/modules/text/precomputeState.c @@ -202,6 +202,7 @@ static void init() LttvAttributeValue value; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); + gboolean retval; g_info("Init precomputeState.c"); @@ -224,29 +225,34 @@ static void init() "Raw binary", LTTV_OPT_NONE, &a_raw, NULL, NULL); - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/event", + LTTV_POINTER, &value); + g_assert(retval); g_assert((event_hook = *(value.v_pointer)) != NULL); lttv_hooks_add(event_hook, for_each_event, &a_event_count, LTTV_PRIO_DEFAULT); - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/trace/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/trace/before", + LTTV_POINTER, &value); + g_assert(retval); g_assert((before_trace = *(value.v_pointer)) != NULL); lttv_hooks_add(before_trace, write_trace_header, NULL, LTTV_PRIO_DEFAULT); - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/trace/after", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/trace/after", + LTTV_POINTER, &value); + g_assert(retval); g_assert((after_trace = *(value.v_pointer)) != NULL); lttv_hooks_add(after_trace, write_trace_footer, NULL, LTTV_PRIO_DEFAULT); - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/traceset/before", + LTTV_POINTER, &value); + g_assert(retval); g_assert((before_traceset = *(value.v_pointer)) != NULL); lttv_hooks_add(before_traceset, write_traceset_header, NULL, LTTV_PRIO_DEFAULT); - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/after", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/traceset/after", + LTTV_POINTER, &value); + g_assert(retval); g_assert((after_traceset = *(value.v_pointer)) != NULL); lttv_hooks_add(after_traceset, write_traceset_footer, NULL, LTTV_PRIO_DEFAULT); diff --git a/lttv/modules/text/textFilter.c b/lttv/modules/text/textFilter.c index 27425201..28b5c8ee 100644 --- a/lttv/modules/text/textFilter.c +++ b/lttv/modules/text/textFilter.c @@ -67,6 +67,7 @@ void filter_analyze_file(void *hook_data) { LttvAttributeValue value; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); + gboolean retval; /* * User may specify filtering options through static file @@ -82,8 +83,6 @@ void filter_analyze_file(void *hook_data) { g_file_get_contents(a_file_name,&a_file_content,NULL,NULL); - g_assert(lttv_iattribute_find_by_path(attributes, "filter/expression", - LTTV_POINTER, &value)); if(((GString*)*(value.v_pointer))->len != 0) g_string_append_c((GString*)*(value.v_pointer),'&'); @@ -91,6 +90,9 @@ void filter_analyze_file(void *hook_data) { g_string_append((GString*)*(value.v_pointer),a_file_content); g_string_append_c((GString*)*(value.v_pointer),')'); + retval= lttv_iattribute_find_by_path(attributes, "filter/expression", + LTTV_POINTER, &value); + g_assert(retval); } /** @@ -102,14 +104,13 @@ void filter_analyze_string(void *hook_data) { LttvAttributeValue value; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); - + gboolean retval; + /* * User may specify filtering options through static file * and/or command line string. From these sources, an * option string is rebuilded and sent to the filter core */ - g_assert(lttv_iattribute_find_by_path(attributes, "filter/expression", - LTTV_POINTER, &value)); if(((GString*)*(value.v_pointer))->len != 0) g_string_append_c((GString*)*(value.v_pointer),'&'); @@ -117,6 +118,9 @@ void filter_analyze_string(void *hook_data) { g_string_append((GString*)*(value.v_pointer),a_string); g_string_append_c((GString*)*(value.v_pointer),')'); + retval= lttv_iattribute_find_by_path(attributes, "filter/expression", + LTTV_POINTER, &value); + g_assert(retval); } /** @@ -168,9 +172,11 @@ static void init() { LttvAttributeValue value; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); + gboolean retval; - g_assert(lttv_iattribute_find_by_path(attributes, "filter/expression", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "filter/expression", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = g_string_new(""); @@ -200,6 +206,8 @@ static void init() { * Destroy the current module */ static void destroy() { + gboolean retval; + g_info("Destroy textFilter"); lttv_option_remove("expression"); @@ -212,8 +220,9 @@ static void destroy() { LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); - g_assert(lttv_iattribute_find_by_path(attributes, "filter/expression", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "filter/expression", + LTTV_POINTER, &value); + g_assert(retval); g_string_free((GString*)*(value.v_pointer),TRUE); -- 2.34.1