glib r6865 - in trunk/gio: . fen



Author: linma
Date: Mon Apr 21 02:40:40 2008
New Revision: 6865
URL: http://svn.gnome.org/viewvc/glib?rev=6865&view=rev

Log:

2008-04-21  Lin Ma  <Lin Ma Sun COM>

	* fen/fen-data.c, fen/fen-helper.c, fen/fen-missing.c, fen/fen-node.c:
	Default disable all loggings.
	* fen/fen-kernel.c: (printevent), (port_add_kevent),
	(port_fetch_event_cb): Fixed two macro nits.



Modified:
   trunk/gio/ChangeLog
   trunk/gio/fen/fen-data.c
   trunk/gio/fen/fen-helper.c
   trunk/gio/fen/fen-kernel.c
   trunk/gio/fen/fen-missing.c
   trunk/gio/fen/fen-node.c

Modified: trunk/gio/fen/fen-data.c
==============================================================================
--- trunk/gio/fen/fen-data.c	(original)
+++ trunk/gio/fen/fen-data.c	Mon Apr 21 02:40:40 2008
@@ -43,11 +43,12 @@
 #define	INIT_CHANGES_NUM	2
 #define	BASE_NUM	2
 
-#define FD_W if (fd_debug_enabled) g_warning
 #ifdef GIO_COMPILATION
+#define FD_W if (fd_debug_enabled) g_warning
 static gboolean fd_debug_enabled = FALSE;
 #else
-static gboolean fd_debug_enabled = TRUE;
+#include "gam_error.h"
+#define FD_W(...) GAM_DEBUG(DEBUG_INFO, __VA_ARGS__)
 #endif
 
 G_LOCK_EXTERN (fen_lock);

Modified: trunk/gio/fen/fen-helper.c
==============================================================================
--- trunk/gio/fen/fen-helper.c	(original)
+++ trunk/gio/fen/fen-helper.c	Mon Apr 21 02:40:40 2008
@@ -35,11 +35,12 @@
 #include "gam_protocol.h"
 #endif
 
-#define FH_W if (fh_debug_enabled) g_warning
 #ifdef GIO_COMPILATION
+#define FH_W if (fh_debug_enabled) g_warning
 static gboolean fh_debug_enabled = FALSE;
 #else
-static gboolean fh_debug_enabled = TRUE;
+#include "gam_error.h"
+#define FH_W(...) GAM_DEBUG(DEBUG_INFO, __VA_ARGS__)
 #endif
 
 G_LOCK_EXTERN (fen_lock);

Modified: trunk/gio/fen/fen-kernel.c
==============================================================================
--- trunk/gio/fen/fen-kernel.c	(original)
+++ trunk/gio/fen/fen-kernel.c	Mon Apr 21 02:40:40 2008
@@ -33,17 +33,18 @@
 #include "fen-kernel.h"
 #include "fen-dump.h"
 
-#define FK_W if (fk_debug_enabled) g_warning
 #ifdef GIO_COMPILATION
+#define FK_W if (fk_debug_enabled) g_warning
 static gboolean fk_debug_enabled = FALSE;
 #else
-static gboolean fk_debug_enabled = TRUE;
+#include "gam_error.h"
+#define FK_W(...) GAM_DEBUG(DEBUG_INFO, __VA_ARGS__)
 #endif
 
 G_GNUC_INTERNAL G_LOCK_DEFINE (fen_lock);
 #define PE_ALLOC	64
-#define F_PORT(pp)		(((_f *)(fo))->port->port)
-#define F_NAME(pp)		(((_f *)(fo))->fobj->fo_name)
+#define F_PORT(pfo)		(((_f *)(pfo))->port->port)
+#define F_NAME(pfo)		(((_f *)(pfo))->fobj->fo_name)
 #define FEN_ALL_EVENTS	(FILE_MODIFIED | FILE_ATTRIB | FILE_NOFOLLOW)
 #define FEN_IGNORE_EVENTS	(FILE_ACCESS)
 #define PROCESS_PORT_EVENTS_TIME	400	/* in milliseconds */
@@ -85,12 +86,17 @@
     return FALSE;
 }
 
-static void
+static gchar*
 printevent (const char *pname, int event, const char *tag)
 {
-    GString* str;
+    static gchar	*event_string = NULL;
+    GString			*str;
+
+    if (event_string) {
+        g_free(event_string);
+    }
+
     str = g_string_new ("");
-    
     g_string_printf (str, "[%s] [%-20s]", tag, pname);
     if (event & FILE_ACCESS) {
         str = g_string_append (str, " ACCESS");
@@ -116,9 +122,9 @@
     if (event & MOUNTEDOVER) {
         str = g_string_append (str, " MOUNTEDOVER");
     }
-
-    FK_W ("%s\n", str->str);
-    g_string_free (str, TRUE);
+    event_string = str->str;
+    g_string_free (str, FALSE);
+    return event_string;
 }
 
 static void
@@ -128,7 +134,7 @@
     GTimeVal t;
     gboolean has_twin = FALSE;
     
-    /* printevent (F_NAME(f), e, "org"); */
+    FK_W("%s\n", printevent(F_NAME(f), e, "org"));
     /*
      * Child FILE_DELETE | FILE_RENAME_FROM will trigger parent FILE_MODIFIED.
      * FILE_MODIFIED will trigger FILE_ATTRIB.
@@ -224,7 +230,8 @@
                        delete the pnode */
                     fo->is_active = FALSE;
                     if (fo->user_data) {
-                        printevent (F_NAME(fo), pe[i].portev_events, "RAW");
+                        FK_W("%s\n",
+                          printevent(F_NAME(fo), pe[i].portev_events, "RAW"));
                         port_add_kevent (pe[i].portev_events, fo->user_data);
                     } else {
                         /* fnode is deleted */

Modified: trunk/gio/fen/fen-missing.c
==============================================================================
--- trunk/gio/fen/fen-missing.c	(original)
+++ trunk/gio/fen/fen-missing.c	Mon Apr 21 02:40:40 2008
@@ -29,10 +29,16 @@
 
 G_LOCK_EXTERN (fen_lock);
 #define SCAN_MISSING_INTERVAL 4000	/* in milliseconds */
+
+#ifdef GIO_COMPILATION
 #define FM_W if (fm_debug_enabled) g_warning
+gboolean fm_debug_enabled = FALSE;
+#else
+#include "gam_error.h"
+#define FM_W(...) GAM_DEBUG(DEBUG_INFO, __VA_ARGS__)
+#endif
 
 /* global data structure for scan missing files */
-gboolean fm_debug_enabled = TRUE;
 static GList *missing_list = NULL;
 static guint scan_missing_source_id = 0;
 

Modified: trunk/gio/fen/fen-node.c
==============================================================================
--- trunk/gio/fen/fen-node.c	(original)
+++ trunk/gio/fen/fen-node.c	Mon Apr 21 02:40:40 2008
@@ -37,8 +37,13 @@
     GTimeVal tv;
 };
 
+#ifdef GIO_COMPILATION
 #define FN_W if (fn_debug_enabled) g_warning
 static gboolean fn_debug_enabled = FALSE;
+#else
+#include "gam_error.h"
+#define FN_W(...) GAM_DEBUG(DEBUG_INFO, __VA_ARGS__)
+#endif
 
 G_LOCK_EXTERN (fen_lock);
 #define	PROCESS_DELETING_INTERVAL	900 /* in second */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]