From 6550d71135aed5d81a76d7d5625757570bcf0819 Mon Sep 17 00:00:00 2001 From: compudj Date: Sat, 14 Aug 2004 21:12:12 +0000 Subject: [PATCH] make inline correct git-svn-id: http://ltt.polymtl.ca/svn@759 04897980-b3bd-0310-b5e0-8ef037075253 --- .../poly/lttv/modules/gui/controlflow/cfv.c | 12 ---- .../poly/lttv/modules/gui/controlflow/cfv.h | 17 ++++-- .../lttv/modules/gui/controlflow/drawing.c | 44 -------------- .../lttv/modules/gui/controlflow/drawing.h | 59 +++++++++++++++---- .../lttv/modules/gui/controlflow/drawitem.c | 10 ++-- .../lttv/modules/gui/controlflow/drawitem.h | 10 ++-- .../lttv/modules/gui/controlflow/eventhooks.c | 6 +- .../modules/gui/controlflow/processlist.c | 57 +----------------- .../modules/gui/controlflow/processlist.h | 57 +++++++++++++++--- .../gui/lttvwindow/lttvwindow/lttvwindow.c | 17 ------ .../gui/lttvwindow/lttvwindow/lttvwindow.h | 15 +++-- .../modules/gui/lttvwindow/lttvwindow/menu.c | 8 ++- .../gui/lttvwindow/lttvwindow/toolbar.c | 8 ++- 13 files changed, 146 insertions(+), 174 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c index e2977da8..8d4a339e 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c @@ -211,16 +211,4 @@ guicontrolflow_destructor(ControlFlowData *control_flow_data) } -__inline__ GtkWidget *guicontrolflow_get_widget( - ControlFlowData *control_flow_data) -{ - return control_flow_data->top_widget ; -} - -__inline__ ProcessList *guicontrolflow_get_process_list - (ControlFlowData *control_flow_data) -{ - return control_flow_data->process_list ; -} - diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h index 1c171758..03cef7e7 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h @@ -33,10 +33,19 @@ void guicontrolflow_destructor_full(ControlFlowData *control_flow_data); void guicontrolflow_destructor(ControlFlowData *control_flow_data); -__inline__ GtkWidget *guicontrolflow_get_widget( - ControlFlowData *control_flow_data); -__inline__ ProcessList *guicontrolflow_get_process_list( - ControlFlowData *control_flow_data); + +inline GtkWidget *guicontrolflow_get_widget( + ControlFlowData *control_flow_data) +{ + return control_flow_data->top_widget ; +} + +inline ProcessList *guicontrolflow_get_process_list + (ControlFlowData *control_flow_data) +{ + return control_flow_data->process_list ; +} + #endif // _CFV_H diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c index 33a8124b..d94a509e 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c @@ -924,50 +924,6 @@ GtkWidget *drawing_get_widget(Drawing_t *drawing) return drawing->vbox; } -/* convert_pixels_to_time - * - * Convert from window pixel and time interval to an absolute time. - */ -__inline__ void convert_pixels_to_time( - gint width, - guint x, - TimeWindow time_window, - LttTime *time) -{ - double time_d; - - time_d = time_window.time_width_double; - time_d = time_d / (double)width * (double)x; - *time = ltt_time_from_double(time_d); - *time = ltt_time_add(time_window.start_time, *time); -} - - -__inline__ void convert_time_to_pixels( - TimeWindow time_window, - LttTime time, - int width, - guint *x) -{ - double time_d; -#ifdef EXTRA_CHECK - g_assert(ltt_time_compare(window_time_begin, time) <= 0 && - ltt_time_compare(window_time_end, time) >= 0); -#endif //EXTRA_CHECK - - time = ltt_time_sub(time, time_window.start_time); - - time_d = ltt_time_to_double(time); - - if(time_window.time_width_double == 0.0) { - g_assert(time_d == 0.0); - *x = 0; - } else { - *x = (guint)(time_d / time_window.time_width_double * (double)width); - } - -} - void drawing_draw_line( Drawing_t *drawing, GdkPixmap *pixmap, guint x1, guint y1, diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.h b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.h index 6cbcb848..02dd33e4 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.h +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.h @@ -134,18 +134,6 @@ void drawing_remove_square(Drawing_t *drawing, guint y, guint height); -__inline__ void convert_pixels_to_time( - gint width, - guint x, - TimeWindow time_window, - LttTime *time); - -__inline__ void convert_time_to_pixels( - TimeWindow time_window, - LttTime time, - gint width, - guint *x); - void drawing_update_ruler(Drawing_t *drawing, TimeWindow *time_window); void drawing_request_expose(EventsRequest *events_request, @@ -164,4 +152,51 @@ tree_row_activated(GtkTreeModel *treemodel, GtkTreeViewColumn *arg2, gpointer user_data); + +/* convert_pixels_to_time + * + * Convert from window pixel and time interval to an absolute time. + */ +inline void convert_pixels_to_time( + gint width, + guint x, + TimeWindow time_window, + LttTime *time) +{ + double time_d; + + time_d = time_window.time_width_double; + time_d = time_d / (double)width * (double)x; + *time = ltt_time_from_double(time_d); + *time = ltt_time_add(time_window.start_time, *time); +} + + +inline void convert_time_to_pixels( + TimeWindow time_window, + LttTime time, + int width, + guint *x) +{ + double time_d; +#ifdef EXTRA_CHECK + g_assert(ltt_time_compare(window_time_begin, time) <= 0 && + ltt_time_compare(window_time_end, time) >= 0); +#endif //EXTRA_CHECK + + time = ltt_time_sub(time, time_window.start_time); + + time_d = ltt_time_to_double(time); + + if(time_window.time_width_double == 0.0) { + g_assert(time_d == 0.0); + *x = 0; + } else { + *x = (guint)(time_d / time_window.time_width_double * (double)width); + } + +} + + + #endif // _DRAWING_H diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.c b/ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.c index c71aeebe..a3085a8a 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.c @@ -111,7 +111,7 @@ #define MAX_PATH_LEN 256 /* drawing hook functions */ -__inline__ gboolean draw_text( void *hook_data, void *call_data) +gboolean draw_text( void *hook_data, void *call_data) { PropertiesText *properties = (PropertiesText*)hook_data; DrawContext *draw_context = (DrawContext*)call_data; @@ -206,7 +206,7 @@ __inline__ gboolean draw_text( void *hook_data, void *call_data) /* To speed up the process, search in already loaded icons list first. Only * load it if not present. */ -__inline__ gboolean draw_icon( void *hook_data, void *call_data) +gboolean draw_icon( void *hook_data, void *call_data) { PropertiesIcon *properties = (PropertiesIcon*)hook_data; DrawContext *draw_context = (DrawContext*)call_data; @@ -311,7 +311,7 @@ __inline__ gboolean draw_icon( void *hook_data, void *call_data) return 0; } -__inline__ gboolean draw_line( void *hook_data, void *call_data) +gboolean draw_line( void *hook_data, void *call_data) { PropertiesLine *properties = (PropertiesLine*)hook_data; DrawContext *draw_context = (DrawContext*)call_data; @@ -357,7 +357,7 @@ __inline__ gboolean draw_line( void *hook_data, void *call_data) return 0; } -__inline__ gboolean draw_arc( void *hook_data, void *call_data) +gboolean draw_arc( void *hook_data, void *call_data) { PropertiesArc *properties = (PropertiesArc*)hook_data; DrawContext *draw_context = (DrawContext*)call_data; @@ -433,7 +433,7 @@ __inline__ gboolean draw_arc( void *hook_data, void *call_data) return 0; } -__inline__ gboolean draw_bg( void *hook_data, void *call_data) +gboolean draw_bg( void *hook_data, void *call_data) { PropertiesBG *properties = (PropertiesBG*)hook_data; DrawContext *draw_context = (DrawContext*)call_data; diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.h b/ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.h index 434f2007..df945e3a 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.h +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.h @@ -268,11 +268,11 @@ void exec_operations( LttvIAttribute *attributes, * different items. */ -__inline__ gboolean draw_text( void *hook_data, void *call_data); -__inline__ gboolean draw_icon( void *hook_data, void *call_data); -__inline__ gboolean draw_line( void *hook_data, void *call_data); -__inline__ gboolean draw_arc( void *hook_data, void *call_data); -__inline__ gboolean draw_bg( void *hook_data, void *call_data); +gboolean draw_text( void *hook_data, void *call_data); +gboolean draw_icon( void *hook_data, void *call_data); +gboolean draw_line( void *hook_data, void *call_data); +gboolean draw_arc( void *hook_data, void *call_data); +gboolean draw_bg( void *hook_data, void *call_data); #endif // _DRAW_ITEM_H diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index ce655eba..14ae5359 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -271,7 +271,7 @@ int event_selected_hook(void *hook_data, void *call_data) } /* Function that selects the color of status&exemode line */ -static __inline__ PropertiesLine prepare_s_e_line(LttvProcessState *process) +static inline PropertiesLine prepare_s_e_line(LttvProcessState *process) { PropertiesLine prop_line; prop_line.line_width = 2; @@ -318,7 +318,7 @@ static __inline__ PropertiesLine prepare_s_e_line(LttvProcessState *process) } #if 0 -static __inline__ PropertiesLine prepare_status_line(LttvProcessState *process) +static inline PropertiesLine prepare_status_line(LttvProcessState *process) { PropertiesLine prop_line; prop_line.line_width = 2; @@ -1937,7 +1937,7 @@ int after_schedchange_hook(void *hook_data, void *call_data) } #if 0 -static __inline__ PropertiesLine prepare_execmode_line(LttvProcessState *process) +static inline PropertiesLine prepare_execmode_line(LttvProcessState *process) { PropertiesLine prop_line; prop_line.line_width = 1; diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c index 727f74ed..644cce52 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c @@ -32,7 +32,7 @@ * Methods to synchronize process list * *****************************************************************************/ -//static __inline__ guint get_cpu_number_from_name(GQuark name); +//static inline guint get_cpu_number_from_name(GQuark name); /* Enumeration of the columns */ enum @@ -442,7 +442,7 @@ GtkWidget *processlist_get_widget(ProcessList *process_list) -static __inline__ gint get_cell_height(ProcessList *process_list, GtkTreeView *tree_view) +static inline gint get_cell_height(ProcessList *process_list, GtkTreeView *tree_view) { gint height = process_list->cell_height_cache; if(height != -1) return height; @@ -592,59 +592,8 @@ int processlist_remove( ProcessList *process_list, } -__inline__ guint processlist_get_height(ProcessList *process_list) -{ - return get_cell_height(process_list, - (GtkTreeView*)process_list->process_list_widget) - * process_list->number_of_process ; -} - - -__inline__ HashedProcessData *processlist_get_process_data( - ProcessList *process_list, - guint pid, guint cpu, LttTime *birth, guint trace_num) -{ - ProcessInfo process_info; - gint *path_indices; - GtkTreePath *tree_path; - - process_info.pid = pid; - if(pid == 0) - process_info.cpu = cpu; - else - process_info.cpu = 0; - process_info.birth = *birth; - process_info.trace_num = trace_num; - - return (HashedProcessData*)g_hash_table_lookup( - process_list->process_hash, - &process_info); -} - - -__inline__ gint processlist_get_pixels_from_data( ProcessList *process_list, - HashedProcessData *hashed_process_data, - guint *y, - guint *height) -{ - gint *path_indices; - GtkTreePath *tree_path; - - tree_path = gtk_tree_model_get_path((GtkTreeModel*)process_list->list_store, - &hashed_process_data->y_iter); - path_indices = gtk_tree_path_get_indices (tree_path); - - *height = get_cell_height(process_list, - (GtkTreeView*)process_list->process_list_widget); - *y = *height * path_indices[0]; - gtk_tree_path_free(tree_path); - - return 0; - -} - #if 0 -static __inline__ guint get_cpu_number_from_name(GQuark name) +static inline guint get_cpu_number_from_name(GQuark name) { const gchar *string; char *begin; diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.h b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.h index 437110a1..1a4f743e 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.h +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.h @@ -112,15 +112,58 @@ int processlist_add(ProcessList *process_list, guint pid, guint cpu, guint ppid, int processlist_remove(ProcessList *process_list, guint pid, guint cpu, LttTime *birth, guint trace_num); -__inline__ guint processlist_get_height(ProcessList *process_list); -__inline__ HashedProcessData *processlist_get_process_data( - ProcessList *process_list, - guint pid, guint cpu, LttTime *birth, guint trace_num); - -__inline__ gint processlist_get_pixels_from_data( ProcessList *process_list, +inline guint processlist_get_height(ProcessList *process_list) +{ + return get_cell_height(process_list, + (GtkTreeView*)process_list->process_list_widget) + * process_list->number_of_process ; +} + + +inline HashedProcessData *processlist_get_process_data( + ProcessList *process_list, + guint pid, guint cpu, LttTime *birth, guint trace_num) +{ + ProcessInfo process_info; + gint *path_indices; + GtkTreePath *tree_path; + + process_info.pid = pid; + if(pid == 0) + process_info.cpu = cpu; + else + process_info.cpu = 0; + process_info.birth = *birth; + process_info.trace_num = trace_num; + + return (HashedProcessData*)g_hash_table_lookup( + process_list->process_hash, + &process_info); +} + + +inline gint processlist_get_pixels_from_data( ProcessList *process_list, HashedProcessData *hashed_process_data, guint *y, - guint *height); + guint *height) +{ + gint *path_indices; + GtkTreePath *tree_path; + + tree_path = gtk_tree_model_get_path((GtkTreeModel*)process_list->list_store, + &hashed_process_data->y_iter); + path_indices = gtk_tree_path_get_indices (tree_path); + + *height = get_cell_height(process_list, + (GtkTreeView*)process_list->process_list_widget); + *y = *height * path_indices[0]; + gtk_tree_path_free(tree_path); + + return 0; + +} + + #endif // _PROCESS_LIST_H diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c index 10bc10c3..c44a39bd 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -906,23 +906,6 @@ void lttvwindow_events_request_remove_all(Tab *tab, } - -/** - * Function to get the current time interval shown on the current tab. - * It will be called by a viewer's hook function to update the - * shown time interval of the viewer and also be called by the constructor - * of the viewer. - * @param tab viewer's tab - * @return time window. - */ - -__inline__ TimeWindow lttvwindow_get_time_window(Tab *tab) -{ - return tab->time_window; - -} - - /** * Function to get the current time/event of the current tab. * It will be called by a viewer's hook function to update the diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h index dc64bb4a..157ed164 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h @@ -658,13 +658,18 @@ void lttvwindow_events_request_remove_all(Tab *tab, /** - * Function to get the current time window of the current tab. - * - * @param tab the tab the viewer belongs to. - * @return the current tab's time interval. + * Function to get the current time interval shown on the current tab. + * It will be called by a viewer's hook function to update the + * shown time interval of the viewer and also be called by the constructor + * of the viewer. + * @param tab viewer's tab + * @return time window. */ -__inline__ TimeWindow lttvwindow_get_time_window(Tab *tab); +inline TimeWindow lttvwindow_get_time_window(Tab *tab) +{ + return tab->time_window; +} /** diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/menu.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/menu.c index 33f170b0..90a782b5 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/menu.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/menu.c @@ -20,19 +20,21 @@ #include -inline LttvMenus *lttv_menus_new() { +LttvMenus *lttv_menus_new() { return g_array_new(FALSE, FALSE, sizeof(LttvMenuClosure)); } /* MD: delete elements of the array also, but don't free pointed addresses * (functions). */ -inline void lttv_menus_destroy(LttvMenus *h) { +void lttv_menus_destroy(LttvMenus *h) { g_debug("lttv_menus_destroy()"); g_array_free(h, TRUE); } -inline LttvMenuClosure lttv_menus_add(LttvMenus *h, lttvwindow_viewer_constructor f, char* menu_path, char* menu_text, GtkWidget *widget) +LttvMenuClosure lttv_menus_add(LttvMenus *h, + lttvwindow_viewer_constructor f, + char* menu_path, char* menu_text, GtkWidget *widget) { LttvMenuClosure c; diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/toolbar.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/toolbar.c index feda92c5..8a7eb4a2 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/toolbar.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/toolbar.c @@ -19,19 +19,21 @@ #include #include -inline LttvToolbars *lttv_toolbars_new() { +LttvToolbars *lttv_toolbars_new() { return g_array_new(FALSE, FALSE, sizeof(LttvToolbarClosure)); } /* MD: delete elements of the array also, but don't free pointed addresses * (functions). */ -inline void lttv_toolbars_destroy(LttvToolbars *h) { +void lttv_toolbars_destroy(LttvToolbars *h) { g_debug("lttv_toolbars_destroy"); g_array_free(h, TRUE); } -inline LttvToolbarClosure lttv_toolbars_add(LttvToolbars *h, lttvwindow_viewer_constructor f, char* tooltip, char ** pixmap, GtkWidget *widget) +LttvToolbarClosure lttv_toolbars_add(LttvToolbars *h, + lttvwindow_viewer_constructor f, + char* tooltip, char ** pixmap, GtkWidget *widget) { LttvToolbarClosure c; -- 2.34.1