From 4ec0c90410f2c28ec11fc20a0acf28ce30a97950 Mon Sep 17 00:00:00 2001 From: compudj Date: Mon, 12 Jun 2006 23:14:33 +0000 Subject: [PATCH] g_string_append fixups git-svn-id: http://ltt.polymtl.ca/svn@1926 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/filter.c | 15 +++++----- ltt/branches/poly/lttv/lttv/module.c | 4 +-- .../poly/lttv/modules/gui/filter/filter.c | 16 +++++------ .../poly/lttv/modules/text/batchAnalysis.c | 3 +- .../poly/lttv/modules/text/textDump.c | 4 +-- .../poly/lttv/modules/text/textFilter.c | 28 +++++++++++++------ 6 files changed, 41 insertions(+), 29 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/filter.c b/ltt/branches/poly/lttv/lttv/filter.c index 6337cd2c..6b42249e 100644 --- a/ltt/branches/poly/lttv/lttv/filter.c +++ b/ltt/branches/poly/lttv/lttv/filter.c @@ -488,7 +488,7 @@ lttv_simple_expression_assign_value(LttvSimpleExpression* se, char* value) { t.tv_sec = atoi(v->str); g_string_free(v,TRUE); v = g_string_new(""); - } else g_string_append_c(v,value[i]); + } else v = g_string_append_c(v,value[i]); } /* number can be integer or double */ if(is_double) t.tv_nsec = atoi(v->str); @@ -1572,9 +1572,10 @@ lttv_filter_update(LttvFilter* filter) { break; default: /* concatening current string */ if(a_string_spaces->len != 0) { - g_string_append(a_field_component, a_string_spaces->str); - a_string_spaces = g_string_set_size(a_string_spaces, 0); - } + a_field_component = g_string_append( + a_field_component, a_string_spaces->str); + a_string_spaces = g_string_set_size(a_string_spaces, 0); + } a_field_component = g_string_append_c(a_field_component, filter->expression[i]); } @@ -1720,10 +1721,10 @@ lttv_filter_append_expression(LttvFilter* filter, const char *expression) { GString* s = g_string_new(""); if(filter->expression != NULL) { - g_string_append(s,filter->expression); - g_string_append_c(s,'&'); + s = g_string_append(s,filter->expression); + s = g_string_append_c(s,'&'); } - g_string_append(s,expression); + s = g_string_append(s,expression); g_free(filter->expression); filter->expression = g_string_free(s,FALSE); diff --git a/ltt/branches/poly/lttv/lttv/module.c b/ltt/branches/poly/lttv/lttv/module.c index aab28bca..2f04b43f 100644 --- a/ltt/branches/poly/lttv/lttv/module.c +++ b/ltt/branches/poly/lttv/lttv/module.c @@ -199,8 +199,8 @@ static LttvLibrary *library_load(char *name, GError **error) if(gm != NULL) break; - g_string_append(messages, g_module_error()); - g_string_append(messages, "\n"); + messages = g_string_append(messages, g_module_error()); + messages = g_string_append(messages, "\n"); g_log(G_LOG_DOMAIN,G_LOG_LEVEL_INFO,"Trial failed, %s", g_module_error()); } diff --git a/ltt/branches/poly/lttv/modules/gui/filter/filter.c b/ltt/branches/poly/lttv/modules/gui/filter/filter.c index dab7d1f3..f12646df 100644 --- a/ltt/branches/poly/lttv/modules/gui/filter/filter.c +++ b/ltt/branches/poly/lttv/modules/gui/filter/filter.c @@ -598,11 +598,11 @@ callback_add_button(GtkWidget *widget, gpointer data) { */ GString* s; s = g_ptr_array_index(fvd->f_logical_op_options,gtk_combo_box_get_active(GTK_COMBO_BOX(fvd->f_logical_op_junction_box))); - g_string_append(a_filter_string,s->str); + a_filter_string = g_string_append(a_filter_string,s->str); gtk_combo_box_set_active(GTK_COMBO_BOX(fvd->f_logical_op_junction_box),0); /* begin expression */ - g_string_append_c(a_filter_string,'('); + a_filter_string = g_string_append_c(a_filter_string,'('); /* * For each simple expression, add the resulting string @@ -615,18 +615,18 @@ callback_add_button(GtkWidget *widget, gpointer data) { fvdl = (FilterViewerDataLine*)g_ptr_array_index(fvd->f_lines,i); s = g_ptr_array_index(fvd->f_not_op_options,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl->f_not_op_box))); - g_string_append(a_filter_string,s->str); + a_filter_string = g_string_append(a_filter_string,s->str); s = g_ptr_array_index(fvd->f_field_options,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl->f_field_box))); - g_string_append(a_filter_string,s->str); + a_filter_string = g_string_append(a_filter_string,s->str); s = g_ptr_array_index(fvd->f_math_op_options,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl->f_math_op_box))); - g_string_append(a_filter_string,s->str); + a_filter_string = g_string_append(a_filter_string,s->str); - g_string_append(a_filter_string,gtk_entry_get_text(GTK_ENTRY(fvdl->f_value_field))); + a_filter_string = g_string_append(a_filter_string,gtk_entry_get_text(GTK_ENTRY(fvdl->f_value_field))); s = g_ptr_array_index(fvd->f_logical_op_options,gtk_combo_box_get_active(GTK_COMBO_BOX(fvdl->f_logical_op_box))); - g_string_append(a_filter_string,s->str); + a_filter_string = g_string_append(a_filter_string,s->str); /* * resetting simple expression lines @@ -636,7 +636,7 @@ callback_add_button(GtkWidget *widget, gpointer data) { } /* end expression */ - g_string_append_c(a_filter_string,')'); + a_filter_string = g_string_append_c(a_filter_string,')'); g_string_prepend(a_filter_string,gtk_entry_get_text(GTK_ENTRY(fvd->f_expression_field))); gtk_entry_set_text(GTK_ENTRY(fvd->f_expression_field),a_filter_string->str); diff --git a/ltt/branches/poly/lttv/modules/text/batchAnalysis.c b/ltt/branches/poly/lttv/modules/text/batchAnalysis.c index 9cd29274..c9e29017 100644 --- a/ltt/branches/poly/lttv/modules/text/batchAnalysis.c +++ b/ltt/branches/poly/lttv/modules/text/batchAnalysis.c @@ -23,6 +23,7 @@ #include #endif +#include #include #include #include @@ -91,7 +92,7 @@ static gboolean process_traceset(void *hook_data, void *call_data) *(value_filter.v_pointer) = lttv_filter_new(); g_debug("Filter string: %s",((GString*)*(value_expression.v_pointer))->str); - + lttv_filter_append_expression(*(value_filter.v_pointer),((GString*)*(value_expression.v_pointer))->str); //lttv_traceset_context_add_hooks(tc, diff --git a/ltt/branches/poly/lttv/modules/text/textDump.c b/ltt/branches/poly/lttv/modules/text/textDump.c index e522595f..2cd60264 100644 --- a/ltt/branches/poly/lttv/modules/text/textDump.c +++ b/ltt/branches/poly/lttv/modules/text/textDump.c @@ -114,7 +114,7 @@ print_tree(FILE *fp, GString *indent, LttvAttribute *tree) fprintf(fp, "\n"); subtree = (LttvAttribute *)*(value.v_gobject); saved_length = indent->len; - g_string_append(indent, " "); + indent = g_string_append(indent, " "); print_tree(fp, indent, subtree); g_string_truncate(indent, saved_length); } @@ -159,7 +159,7 @@ print_stats(FILE *fp, LttvTracesetStats *tscs) start_time.tv_nsec); #endif //FIXME saved_length = indent->len; - g_string_append(indent, " "); + indent = g_string_append(indent, " "); print_tree(fp, indent, tcs->stats); g_string_truncate(indent, saved_length); } diff --git a/ltt/branches/poly/lttv/modules/text/textFilter.c b/ltt/branches/poly/lttv/modules/text/textFilter.c index 6934011c..afac4f91 100644 --- a/ltt/branches/poly/lttv/modules/text/textFilter.c +++ b/ltt/branches/poly/lttv/modules/text/textFilter.c @@ -29,6 +29,7 @@ #include #endif +#include #include #include #include @@ -42,7 +43,6 @@ #include #include #include -#include /* Insert the hooks before and after each trace and tracefile, and for each event. Print a global header. */ @@ -87,10 +87,15 @@ void filter_analyze_file(void *hook_data) { 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),'&'); - g_string_append_c((GString*)*(value.v_pointer),'('); - g_string_append((GString*)*(value.v_pointer),a_file_content); - g_string_append_c((GString*)*(value.v_pointer),')'); + if(((GString*)*(value.v_pointer))->len != 0) + (GString*)*(value.v_pointer) = + g_string_append_c((GString*)*(value.v_pointer),'&'); + (GString*)*(value.v_pointer) = + g_string_append_c((GString*)*(value.v_pointer),'('); + (GString*)*(value.v_pointer) = + g_string_append((GString*)*(value.v_pointer),a_file_content); + (GString*)*(value.v_pointer) = + g_string_append_c((GString*)*(value.v_pointer),')'); } @@ -112,10 +117,15 @@ void filter_analyze_string(void *hook_data) { 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),'&'); - g_string_append_c((GString*)*(value.v_pointer),'('); - g_string_append((GString*)*(value.v_pointer),a_string); - g_string_append_c((GString*)*(value.v_pointer),')'); + if(((GString*)*(value.v_pointer))->len != 0) + (GString*)*(value.v_pointer) = + g_string_append_c((GString*)*(value.v_pointer),'&'); + (GString*)*(value.v_pointer) = + g_string_append_c((GString*)*(value.v_pointer),'('); + (GString*)*(value.v_pointer) = + g_string_append((GString*)*(value.v_pointer),a_string); + (GString*)*(value.v_pointer) = + g_string_append_c((GString*)*(value.v_pointer),')'); } -- 2.34.1