summaryrefslogtreecommitdiff
path: root/gio/fen
diff options
context:
space:
mode:
authorLin Ma <Lin.Ma@Sun.COM>2008-04-21 02:40:40 +0000
committerLin Ma <linma@src.gnome.org>2008-04-21 02:40:40 +0000
commit6965703ad2b7a325df177a8f904c0edddf2f6b57 (patch)
treec35253d53376f853fef6e2783cc722e08796eba9 /gio/fen
parente4d486dc324656c3588ff223487e0bc346fe739d (diff)
Default disable all loggings. Fixed two macro nits.
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. svn path=/trunk/; revision=6865
Diffstat (limited to 'gio/fen')
-rw-r--r--gio/fen/fen-data.c5
-rw-r--r--gio/fen/fen-helper.c5
-rw-r--r--gio/fen/fen-kernel.c31
-rw-r--r--gio/fen/fen-missing.c8
-rw-r--r--gio/fen/fen-node.c5
5 files changed, 37 insertions, 17 deletions
diff --git a/gio/fen/fen-data.c b/gio/fen/fen-data.c
index e49e9f6a6..13b2fe10b 100644
--- a/gio/fen/fen-data.c
+++ b/gio/fen/fen-data.c
@@ -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);
diff --git a/gio/fen/fen-helper.c b/gio/fen/fen-helper.c
index 599cbd5c9..1b2fc218c 100644
--- a/gio/fen/fen-helper.c
+++ b/gio/fen/fen-helper.c
@@ -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);
diff --git a/gio/fen/fen-kernel.c b/gio/fen/fen-kernel.c
index 6c5d20049..ac4f5ca6e 100644
--- a/gio/fen/fen-kernel.c
+++ b/gio/fen/fen-kernel.c
@@ -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 @@ is_ported (gpointer f)
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 @@ printevent (const char *pname, int event, const char *tag)
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 @@ port_add_kevent (int e, gpointer f)
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 @@ port_fetch_event_cb (void *arg)
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 */
diff --git a/gio/fen/fen-missing.c b/gio/fen/fen-missing.c
index c9e9d543e..d42294050 100644
--- a/gio/fen/fen-missing.c
+++ b/gio/fen/fen-missing.c
@@ -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;
diff --git a/gio/fen/fen-node.c b/gio/fen/fen-node.c
index de6a030e7..c1cc56b66 100644
--- a/gio/fen/fen-node.c
+++ b/gio/fen/fen-node.c
@@ -37,8 +37,13 @@ struct _dnode {
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 */