[ltt-dev] [PATCH] Remove duplicated g_debug new line

Francis Giraldeau francis.giraldeau at usherbrooke.ca
Mon Feb 7 16:45:47 EST 2011


g_debug append new line automatically, hence the message string should not
contain it, otherwise two new lines are appended. This trivial patch removes
all duplicated \n.
---
 ltt/marker.c                                 |    2 +-
 ltt/tracefile.c                              |    8 ++++----
 lttv/lttv/filter.c                           |   24 ++++++++++++------------
 lttv/lttv/state.c                            |    6 +++---
 lttv/modules/gui/tracecontrol/tracecontrol.c |    6 +++---
 5 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/ltt/marker.c b/ltt/marker.c
index ade05e1..f2b5d9c 100644
--- a/ltt/marker.c
+++ b/ltt/marker.c
@@ -488,7 +488,7 @@ int marker_id_event(LttTrace *trace, GQuark channel, GQuark name, guint16 id,
   int found = 0;
   GArray *group;
 
-  g_debug("Add channel %s event %s %hu\n", g_quark_to_string(channel),
+  g_debug("Add channel %s event %s %hu", g_quark_to_string(channel),
     g_quark_to_string(name), id);
 
   group = g_datalist_id_get_data(&trace->tracefiles, channel);
diff --git a/ltt/tracefile.c b/ltt/tracefile.c
index 012ce10..3b9cbd3 100644
--- a/ltt/tracefile.c
+++ b/ltt/tracefile.c
@@ -636,13 +636,13 @@ static int open_tracefiles(LttTrace *trace, gchar *root_path, gchar *relative_pa
       continue;
     }
     
-    g_debug("Tracefile file or directory : %s\n", path);
+    g_debug("Tracefile file or directory : %s", path);
     
   //  if(strcmp(rel_path, "/eventdefs") == 0) continue;
     
     if(S_ISDIR(stat_buf.st_mode)) {
 
-      g_debug("Entering subdirectory...\n");
+      g_debug("Entering subdirectory...");
       ret = open_tracefiles(trace, path, rel_path);
       if(ret < 0) continue;
     } else if(S_ISREG(stat_buf.st_mode)) {
@@ -657,7 +657,7 @@ static int open_tracefiles(LttTrace *trace, gchar *root_path, gchar *relative_pa
       if(get_tracefile_name_number(rel_path, &name, &num, &tid, &pgid, &creation))
         continue; /* invalid name */
       
-      g_debug("Opening file.\n");
+      g_debug("Opening file.");
       if(ltt_tracefile_open(trace, path, &tmp_tf)) {
         g_info("Error opening tracefile %s", path);
 
@@ -1440,7 +1440,7 @@ static gint map_block(LttTracefile * tf, guint block_num)
   ret = get_block_offset_size(tf, block_num, &offset, &size);
   g_assert(!ret);
 
-  g_debug("Map block %u, offset %llu, size %u\n", block_num,
+  g_debug("Map block %u, offset %llu, size %u", block_num,
           (unsigned long long)offset, (unsigned int)size);
 
   /* Multiple of pages aligned head */
diff --git a/lttv/lttv/filter.c b/lttv/lttv/filter.c
index 29721d4..16b7cb7 100644
--- a/lttv/lttv/filter.c
+++ b/lttv/lttv/filter.c
@@ -1841,9 +1841,9 @@ gboolean lttv_filter_update(LttvFilter* filter)
 #endif
 
 	/* debug */
-	g_debug("+++++++++++++++ BEGIN PRINT ++++++++++++++++\n");
+	g_debug("+++++++++++++++ BEGIN PRINT ++++++++++++++++");
 	lttv_print_tree(filter->head,0) ;
-	g_debug("+++++++++++++++ END PRINT ++++++++++++++++++\n");
+	g_debug("+++++++++++++++ END PRINT ++++++++++++++++++");
 
 	/* success */
 	return TRUE;
@@ -2251,22 +2251,22 @@ gboolean lttv_filter_tree_parse_branch(
  */
 void lttv_print_tree(const LttvFilterTree* t, const int count)
 {
-	g_debug("node:%p lchild:%p rchild:%p depth:%i\n",t, //t->l_child.t,t->r_child.t);
+	g_debug("node:%p lchild:%p rchild:%p depth:%i",t, //t->l_child.t,t->r_child.t);
 			(t->left==LTTV_TREE_NODE)?t->l_child.t:NULL,
 			(t->right==LTTV_TREE_NODE)?t->r_child.t:NULL,
 			count);
-	g_debug("logic operator: %s\n",(t->node&1)?"OR":((t->node&2)?"AND":((t->node&4)?"NOT":((t->node&8)?"XOR":"IDLE"))));
-	g_debug("|-> left branch %p is a %s\n",t->l_child.t,(t->left==LTTV_TREE_NODE)?"NODE":((t->left==LTTV_TREE_LEAF)?"LEAF":"IDLE"));
+	g_debug("logic operator: %s",(t->node&1)?"OR":((t->node&2)?"AND":((t->node&4)?"NOT":((t->node&8)?"XOR":"IDLE"))));
+	g_debug("|-> left branch %p is a %s",t->l_child.t,(t->left==LTTV_TREE_NODE)?"NODE":((t->left==LTTV_TREE_LEAF)?"LEAF":"IDLE"));
 	if(t->left == LTTV_TREE_LEAF) {
-		g_debug("| |-> field type number: %i\n",t->l_child.leaf->field);
-		g_debug("| |-> offset is: %i\n",t->l_child.leaf->offset);
-		g_debug("| |-> operator function is: %p\n",t->l_child.leaf->op);
+		g_debug("| |-> field type number: %i",t->l_child.leaf->field);
+		g_debug("| |-> offset is: %i",t->l_child.leaf->offset);
+		g_debug("| |-> operator function is: %p",t->l_child.leaf->op);
 	}
-	g_debug("|-> right branch %p is a %s\n",t->r_child.t,(t->right==LTTV_TREE_NODE)?"NODE":((t->right==LTTV_TREE_LEAF)?"LEAF":"IDLE"));
+	g_debug("|-> right branch %p is a %s",t->r_child.t,(t->right==LTTV_TREE_NODE)?"NODE":((t->right==LTTV_TREE_LEAF)?"LEAF":"IDLE"));
 	if(t->right == LTTV_TREE_LEAF) {
-		g_debug("| |-> field type number: %i\n",t->r_child.leaf->field);
-		g_debug("| |-> offset is: %i\n",t->r_child.leaf->offset);
-		g_debug("| |-> operator function is: %p\n",t->r_child.leaf->op);
+		g_debug("| |-> field type number: %i",t->r_child.leaf->field);
+		g_debug("| |-> offset is: %i",t->r_child.leaf->offset);
+		g_debug("| |-> operator function is: %p",t->r_child.leaf->op);
 	}
 
 	if(t->left == LTTV_TREE_NODE) lttv_print_tree(t->l_child.t,count+1);
diff --git a/lttv/lttv/state.c b/lttv/lttv/state.c
index e98275e..0d7255e 100644
--- a/lttv/lttv/state.c
+++ b/lttv/lttv/state.c
@@ -2977,7 +2977,7 @@ static gboolean sched_try_wakeup(void *hook_data, void *call_data)
 		process->state->change = s->parent.timestamp;
 	}
 
-	g_debug("Wakeup: process %d on CPU %u\n", woken_pid, woken_cpu);
+	g_debug("Wakeup: process %d on CPU %u", woken_pid, woken_cpu);
 
 	return FALSE;
 }
@@ -3338,13 +3338,13 @@ static void print_stack(LttvProcessState *process)
 	LttvExecutionState *es;
 	int i;
 
-	g_debug("Execution stack for process %u %s:\n",
+	g_debug("Execution stack for process %u %s:",
 			process->pid, g_quark_to_string(process->name));
 
 	for (i = 0; i < process->execution_stack->len; i++) {
 		es = &g_array_index(process->execution_stack,
 				LttvExecutionState, i);
-		g_debug("Depth %d mode %s submode %s status %s\n",
+		g_debug("Depth %d mode %s submode %s status %s",
 				i, g_quark_to_string(es->t),
 				g_quark_to_string(es->n),
 				g_quark_to_string(es->s));
diff --git a/lttv/modules/gui/tracecontrol/tracecontrol.c b/lttv/modules/gui/tracecontrol/tracecontrol.c
index a02301b..9d98e2b 100644
--- a/lttv/modules/gui/tracecontrol/tracecontrol.c
+++ b/lttv/modules/gui/tracecontrol/tracecontrol.c
@@ -536,18 +536,18 @@ static int execute_command(const gchar *command, const gchar *username,
 	    case GET_LINE:
 	      if(buf[i] == '\n') {
 		read_state = GET_SEMI;
-		g_debug("Tracecontrol input line skip\n");
+		g_debug("Tracecontrol input line skip");
 	      }
 	      break;
 	    case GET_SEMI:
 	      if(buf[i] == ':') {
-		g_debug("Tracecontrol input  : marker found\n");
+		g_debug("Tracecontrol input  : marker found");
 		read_state = GET_SPACE;
 	      }
 	      break;
 	    case GET_SPACE:
 	      if(buf[i] == ' ') {
-		g_debug("Tracecontrol input space marker found\n");
+		g_debug("Tracecontrol input space marker found");
 		goto write_password;
 	      }
 	      break;
-- 
1.7.1





More information about the lttng-dev mailing list