[maemo-commits] [maemo-commits] r15425 - in projects/haf/trunk/maemo-launcher: . launcher

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Apr 16 01:35:55 EEST 2008
Author: guillem
Date: 2008-04-16 01:35:54 +0300 (Wed, 16 Apr 2008)
New Revision: 15425

Modified:
   projects/haf/trunk/maemo-launcher/ChangeLog
   projects/haf/trunk/maemo-launcher/launcher/comm_msg.c
   projects/haf/trunk/maemo-launcher/launcher/comm_msg.h
Log:
Use new comm_msg_print to print comm_msg instead of debug


Modified: projects/haf/trunk/maemo-launcher/ChangeLog
===================================================================
--- projects/haf/trunk/maemo-launcher/ChangeLog	2008-04-15 22:35:52 UTC (rev 15424)
+++ projects/haf/trunk/maemo-launcher/ChangeLog	2008-04-15 22:35:54 UTC (rev 15425)
@@ -1,3 +1,12 @@
+2008-03-18  Guillem Jover  <guillem.jover at nokia.com>
+
+	* launcher/comm_msg.h (comm_msg_print): New prototype.
+	* launcher/comm_msg.c (struct comm_msg): Change buf member from char *
+	to void *.
+	(comm_msg_print): New function.
+	(comm_msg_send): Use comm_msg_print to print msg instead of debug.
+	(comm_msg_recv): Likewise.
+
 2008-03-14  Guillem Jover  <guillem.jover at nokia.com>
 
 	* launcher/comm_msg.c (comm_msg_send): Use msg->used in sizeof instead

Modified: projects/haf/trunk/maemo-launcher/launcher/comm_msg.c
===================================================================
--- projects/haf/trunk/maemo-launcher/launcher/comm_msg.c	2008-04-15 22:35:52 UTC (rev 15424)
+++ projects/haf/trunk/maemo-launcher/launcher/comm_msg.c	2008-04-15 22:35:54 UTC (rev 15425)
@@ -39,7 +39,7 @@
   uint32_t size_max;
   uint32_t used;
   uint32_t read;
-  char *buf;
+  void *buf;
 };
 
 comm_msg_t *
@@ -85,6 +85,19 @@
 }
 
 bool
+comm_msg_print(comm_msg_t *msg, char *func)
+{
+  uint32_t i, *p = msg->buf;
+
+  info("%s: size: %08x\n", func, msg->size);
+
+  for (i = 0; i < msg->used / sizeof(uint32_t); i++)
+    info("%s: data[%04x]: %08x\n", func, i, p[i]);
+
+  return true;
+}
+
+bool
 comm_msg_grow(comm_msg_t *msg, uint32_t need_size)
 {
   uint32_t end_size;
@@ -247,7 +260,9 @@
   write(fd, &msg->used, sizeof(msg->used));
   write(fd, msg->buf, msg->used);
 
-  debug("%s: %08x\n", __FUNCTION__, msg);
+#if DEBUG
+  comm_msg_print(msg, __FUNCTION__);
+#endif
 
   return true;
 }
@@ -265,7 +280,9 @@
   read(fd, msg->buf, size);
   msg->used = size;
 
-  debug("%s: %08x\n", __FUNCTION__, *msg);
+#if DEBUG
+  comm_msg_print(msg, __FUNCTION__);
+#endif
 
   return true;
 }

Modified: projects/haf/trunk/maemo-launcher/launcher/comm_msg.h
===================================================================
--- projects/haf/trunk/maemo-launcher/launcher/comm_msg.h	2008-04-15 22:35:52 UTC (rev 15424)
+++ projects/haf/trunk/maemo-launcher/launcher/comm_msg.h	2008-04-15 22:35:54 UTC (rev 15425)
@@ -30,6 +30,7 @@
 
 comm_msg_t *comm_msg_new(uint32_t size, uint32_t size_max);
 bool comm_msg_destroy(comm_msg_t *msg);
+bool comm_msg_print(comm_msg_t *msg, char *func);
 bool comm_msg_grow(comm_msg_t *msg, uint32_t need_size);
 bool comm_msg_reset(comm_msg_t *msg);
 


More information about the maemo-commits mailing list