mega fix for states : per cpu and _not_ per tracefile state. We have many tracefiles...
[lttv.git] / ltt / branches / poly / lttv / lttv / filter.c
index e837068cb2bfc7ba8091a5ca4ac4932d463ba993..d6defdf713729f1c0f05bd498a5b1d67189962ba 100644 (file)
 #endif
 
 #include <lttv/filter.h>
+#include <ltt/trace.h>
+#include <ltt/type.h>
+#include <stdlib.h>
+#include <string.h>
 
 /**
  * @fn LttvSimpleExpression* lttv_simple_expression_new()
@@ -109,7 +113,7 @@ lttv_simple_expression_assign_field(GPtrArray* fp, LttvSimpleExpression* se) {
   GString* f = NULL;
   
   if(fp->len < 2) return FALSE;
-  g_assert(f=g_ptr_array_remove_index(fp,0)); 
+  g_assert((f=g_ptr_array_remove_index(fp,0))); 
   
   /*
    * Parse through the specified 
@@ -376,7 +380,6 @@ lttv_simple_expression_assign_value(LttvSimpleExpression* se, char* value) {
   gboolean is_double = FALSE;
   LttTime t = ltt_time_zero;
   GString* v;
-  GQuark quark;
   
   switch(se->field) {
      /* 
@@ -421,14 +424,14 @@ lttv_simple_expression_assign_value(LttvSimpleExpression* se, char* value) {
               /* cannot specify number with more than one '.' */
               if(is_double) return FALSE; 
               else is_double = TRUE;
-              t.tv_sec = atoi(v);
+              t.tv_sec = atoi(v->str);
               g_string_free(v,TRUE);
               v = g_string_new("");
           } else g_string_append_c(v,value[i]);
        }
        /* number can be integer or double */
-       if(is_double) t.tv_nsec = atoi(v);
-       else t.tv_sec = atoi(v);
+       if(is_double) t.tv_nsec = atoi(v->str);
+       else t.tv_sec = atoi(v->str);
        
        g_string_free(v,TRUE);
        
@@ -1537,6 +1540,7 @@ lttv_filter_append_expression(LttvFilter* filter, const char *expression) {
 
   if(expression == NULL) return FALSE;
   if(filter == NULL) return FALSE;
+  if(expression[0] == '\0') return FALSE;  /* Empty expression */
 
   GString* s = g_string_new("");
   if(filter->expression != NULL) {
@@ -1782,9 +1786,11 @@ lttv_filter_tree_parse_branch(
         case LTTV_FILTER_STATE_CPU:
             if(context == NULL) return TRUE;
             else {
-              /* FIXME: not sure of that one */
-              GQuark quark = ((LttvTracefileState*)context)->cpu_name;
-              return se->op((gpointer)&quark,v);
+              /* FIXME: not sure of that one  Mathieu : fixed.*/
+ //             GQuark quark = ((LttvTracefileState*)context)->cpu_name;
+ //                return se->op((gpointer)&quark,v);
+              if(state == NULL) return TRUE;
+              else return se->op((gpointer)&state->cpu,v);
             }
             break;
         case LTTV_FILTER_EVENT_NAME:
This page took 0.024539 seconds and 4 git commands to generate.