g_string_append fixups
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 12 Jun 2006 23:14:33 +0000 (23:14 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 12 Jun 2006 23:14:33 +0000 (23:14 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1926 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/filter.c
ltt/branches/poly/lttv/lttv/module.c
ltt/branches/poly/lttv/modules/gui/filter/filter.c
ltt/branches/poly/lttv/modules/text/batchAnalysis.c
ltt/branches/poly/lttv/modules/text/textDump.c
ltt/branches/poly/lttv/modules/text/textFilter.c

index 6337cd2c89f9a6b69b62035d65c86e56e7dda6ab..6b42249e8a4ac03122941deadd1fb3d59bd801a2 100644 (file)
@@ -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);
index aab28bca84b0dc71592b4215a1d02428e3a7d939..2f04b43f5b2de10c29b5756e7bc0d206a65280e9 100644 (file)
@@ -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());
   }
 
index dab7d1f3125ac305d4a4a1a2babdf8721d209cf3..f12646df35e109b5b3e1f3e06158da6956ff5da4 100644 (file)
@@ -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);
index 9cd292741bc907c4472853ac019fe0967d480dcc..c9e2901788eae6152931f4f1e6f292390e83fc53 100644 (file)
@@ -23,6 +23,7 @@
 #include <config.h>
 #endif
 
+#include <glib.h>
 #include <lttv/lttv.h>
 #include <lttv/attribute.h>
 #include <lttv/hook.h>
@@ -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,
index e522595fabd8d87f0ead8e06b03550ded6d8cd19..2cd60264aa15d1c9263a018433dbee713507a875 100644 (file)
@@ -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);
   }
index 6934011c1dd344c49a3b6afcaaa9209994454a3d..afac4f91bc6cdcd4ae1e33e3ac996f55e615a1fc 100644 (file)
@@ -29,6 +29,7 @@
 #include <config.h>
 #endif
 
+#include <glib.h>
 #include <lttv/lttv.h>
 #include <lttv/option.h>
 #include <lttv/module.h>
@@ -42,7 +43,6 @@
 #include <ltt/type.h>
 #include <ltt/trace.h>
 #include <ltt/facility.h>
-#include <stdio.h>
 
 /* 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),')');
 
 }
 
This page took 0.029867 seconds and 4 git commands to generate.