glib r6337 - in trunk/gio: . inotify



Author: matthiasc
Date: Mon Jan 21 05:12:16 2008
New Revision: 6337
URL: http://svn.gnome.org/viewvc/glib?rev=6337&view=rev

Log:
Coding style fixes


Modified:
   trunk/gio/ChangeLog
   trunk/gio/inotify/ginotifydirectorymonitor.c
   trunk/gio/inotify/ginotifyfilemonitor.c
   trunk/gio/inotify/inotify-helper.c
   trunk/gio/inotify/inotify-kernel.c
   trunk/gio/inotify/inotify-missing.c
   trunk/gio/inotify/inotify-path.c
   trunk/gio/inotify/inotify-sub.c

Modified: trunk/gio/inotify/ginotifydirectorymonitor.c
==============================================================================
--- trunk/gio/inotify/ginotifydirectorymonitor.c	(original)
+++ trunk/gio/inotify/ginotifydirectorymonitor.c	Mon Jan 21 05:12:16 2008
@@ -50,7 +50,7 @@
   GInotifyDirectoryMonitor *inotify_monitor = G_INOTIFY_DIRECTORY_MONITOR (object);
   inotify_sub *sub = inotify_monitor->sub;
 
-  if (inotify_monitor->sub)
+  if (sub)
     {
       _ih_sub_cancel (sub);
       _ih_sub_free (sub);
@@ -124,7 +124,6 @@
 static void
 g_inotify_directory_monitor_init (GInotifyDirectoryMonitor* monitor)
 {
-
 }
 
 static gboolean
@@ -133,11 +132,12 @@
   GInotifyDirectoryMonitor *inotify_monitor = G_INOTIFY_DIRECTORY_MONITOR (monitor);
   inotify_sub *sub = inotify_monitor->sub;
 
-  if (sub) {
-    _ih_sub_cancel (sub);
-    _ih_sub_free (sub);
-    inotify_monitor->sub = NULL;
-  }
+  if (sub) 
+    {
+      _ih_sub_cancel (sub);
+      _ih_sub_free (sub);
+      inotify_monitor->sub = NULL;
+    }
 
   if (G_FILE_MONITOR_CLASS (g_inotify_directory_monitor_parent_class)->cancel)
     (*G_FILE_MONITOR_CLASS (g_inotify_directory_monitor_parent_class)->cancel) (monitor);

Modified: trunk/gio/inotify/ginotifyfilemonitor.c
==============================================================================
--- trunk/gio/inotify/ginotifyfilemonitor.c	(original)
+++ trunk/gio/inotify/ginotifyfilemonitor.c	Mon Jan 21 05:12:16 2008
@@ -52,7 +52,7 @@
   GInotifyFileMonitor *inotify_monitor = G_INOTIFY_FILE_MONITOR (object);
   inotify_sub *sub = inotify_monitor->sub;
 
-  if (inotify_monitor->sub)
+  if (sub)
     {
       _ih_sub_cancel (sub);
       _ih_sub_free (sub);
@@ -76,8 +76,8 @@
 }
 
 static GObject *
-g_inotify_file_monitor_constructor (GType type,
-                                    guint n_construct_properties,
+g_inotify_file_monitor_constructor (GType                  type,
+                                    guint                  n_construct_properties,
                                     GObjectConstructParam *construct_properties)
 {
   GObject *obj;
@@ -142,7 +142,6 @@
 static void
 g_inotify_file_monitor_init (GInotifyFileMonitor* monitor)
 {
-
 }
 
 static gboolean
@@ -151,11 +150,12 @@
   GInotifyFileMonitor *inotify_monitor = G_INOTIFY_FILE_MONITOR (monitor);
   inotify_sub *sub = inotify_monitor->sub;
 
-  if (sub) {
-    _ih_sub_cancel (sub);
-    _ih_sub_free (sub);
-    inotify_monitor->sub = NULL;
-  }
+  if (sub) 
+    {
+      _ih_sub_cancel (sub);
+      _ih_sub_free (sub);
+      inotify_monitor->sub = NULL;
+    }
 
   if (G_FILE_MONITOR_CLASS (g_inotify_file_monitor_parent_class)->cancel)
     (*G_FILE_MONITOR_CLASS (g_inotify_file_monitor_parent_class)->cancel) (monitor);

Modified: trunk/gio/inotify/inotify-helper.c
==============================================================================
--- trunk/gio/inotify/inotify-helper.c	(original)
+++ trunk/gio/inotify/inotify-helper.c	Mon Jan 21 05:12:16 2008
@@ -116,7 +116,7 @@
  * Adds a subscription to be monitored.
  */
 gboolean
-_ih_sub_add (inotify_sub * sub)
+_ih_sub_add (inotify_sub *sub)
 {
   G_LOCK (inotify_lock);
 	
@@ -131,7 +131,7 @@
  * Cancels a subscription which was being monitored.
  */
 gboolean
-_ih_sub_cancel (inotify_sub * sub)
+_ih_sub_cancel (inotify_sub *sub)
 {
   G_LOCK (inotify_lock);
 
@@ -150,7 +150,8 @@
 
 
 static void
-ih_event_callback (ik_event_t *event, inotify_sub *sub)
+ih_event_callback (ik_event_t  *event, 
+                   inotify_sub *sub)
 {
   gchar *fullpath;
   GFileMonitorEvent eflags;

Modified: trunk/gio/inotify/inotify-kernel.c
==============================================================================
--- trunk/gio/inotify/inotify-kernel.c	(original)
+++ trunk/gio/inotify/inotify-kernel.c	Mon Jan 21 05:12:16 2008
@@ -95,7 +95,7 @@
  */
 static gboolean
 ik_source_prepare (GSource *source,
-		   gint *timeout)
+		   gint    *timeout)
 {
   return FALSE;
 }
@@ -146,7 +146,8 @@
 	goto do_read;
       
       /* With each successive iteration, the minimum rate for
-       * further sleep doubles. */
+       * further sleep doubles. 
+       */
       if (pending-prev_pending < PENDING_MARGINAL_COST (pending_count))
 	goto do_read;
       
@@ -176,9 +177,9 @@
 }
 
 static gboolean
-ik_source_dispatch (GSource *source,
-		    GSourceFunc callback,
-		    gpointer user_data)
+ik_source_dispatch (GSource     *source,
+		    GSourceFunc  callback,
+		    gpointer     user_data)
 {
   if (callback)
     return callback (user_data);
@@ -215,7 +216,7 @@
   g_io_channel_set_encoding (inotify_read_ioc, NULL, NULL);
   g_io_channel_set_flags (inotify_read_ioc, G_IO_FLAG_NONBLOCK, NULL);
 
-  source = g_source_new (&ik_source_funcs, sizeof(GSource));
+  source = g_source_new (&ik_source_funcs, sizeof (GSource));
   g_source_add_poll (source, &ik_poll_fd);
   g_source_set_callback (source, ik_read_callback, NULL, NULL);
   g_source_attach (source, NULL);
@@ -248,7 +249,7 @@
 ik_event_new (char *buffer)
 {
   struct inotify_event *kevent = (struct inotify_event *)buffer;
-  ik_event_t *event = g_new0(ik_event_t,1);
+  ik_event_t *event = g_new0 (ik_event_t, 1);
   
   g_assert (buffer);
   
@@ -265,9 +266,11 @@
 }
 
 ik_event_t *
-_ik_event_new_dummy (const char *name, gint32 wd, guint32 mask)
+_ik_event_new_dummy (const char *name, 
+                     gint32      wd, 
+                     guint32     mask)
 {
-  ik_event_t *event = g_new0 (ik_event_t,1);
+  ik_event_t *event = g_new0 (ik_event_t, 1);
   event->wd = wd;
   event->mask = mask;
   event->cookie = 0;
@@ -291,7 +294,9 @@
 }
 
 gint32
-_ik_watch (const char *path, guint32 mask, int *err)
+_ik_watch (const char *path, 
+           guint32     mask, 
+           int        *err)
 {
   gint32 wd = -1;
   
@@ -314,7 +319,8 @@
 }
 
 int
-_ik_ignore(const char *path, gint32 wd)
+_ik_ignore (const char *path, 
+            gint32      wd)
 {
   g_assert (wd >= 0);
   g_assert (inotify_instance_fd >= 0);
@@ -330,7 +336,8 @@
 }
 
 void
-_ik_move_stats (guint32 *matches, guint32 *misses)
+_ik_move_stats (guint32 *matches, 
+                guint32 *misses)
 {
   if (matches)
     *matches = ik_move_matches;
@@ -421,7 +428,8 @@
 
 
 static void
-ik_read_events (gsize *buffer_size_out, gchar **buffer_out)
+ik_read_events (gsize  *buffer_size_out, 
+                gchar **buffer_out)
 {
   static gchar *buffer = NULL;
   static gsize buffer_size;
@@ -480,7 +488,8 @@
 }
 
 static gboolean
-g_timeval_lt (GTimeVal *val1, GTimeVal *val2)
+g_timeval_lt (GTimeVal *val1, 
+              GTimeVal *val2)
 {
   if (val1->tv_sec < val2->tv_sec)
     return TRUE;
@@ -496,13 +505,15 @@
 }
 
 static gboolean
-g_timeval_eq (GTimeVal *val1, GTimeVal *val2)
+g_timeval_eq (GTimeVal *val1, 
+              GTimeVal *val2)
 {
   return (val1->tv_sec == val2->tv_sec) && (val1->tv_usec == val2->tv_usec);
 }
 
 static void
-ik_pair_events (ik_event_internal_t *event1, ik_event_internal_t *event2)
+ik_pair_events (ik_event_internal_t *event1, 
+                ik_event_internal_t *event2)
 {
   g_assert (event1 && event2);
   /* We should only be pairing events that have the same cookie */
@@ -521,7 +532,8 @@
 }
 
 static void
-ik_event_add_microseconds (ik_event_internal_t *event, glong ms)
+ik_event_add_microseconds (ik_event_internal_t *event, 
+                           glong                ms)
 {
   g_assert (event);
   g_time_val_add (&event->hold_until, ms);
@@ -549,7 +561,8 @@
 }
 
 static void
-ik_pair_moves (gpointer data, gpointer user_data)
+ik_pair_moves (gpointer data, 
+               gpointer user_data)
 {
   ik_event_internal_t *event = (ik_event_internal_t *)data;
   

Modified: trunk/gio/inotify/inotify-missing.c
==============================================================================
--- trunk/gio/inotify/inotify-missing.c	(original)
+++ trunk/gio/inotify/inotify-missing.c	Mon Jan 21 05:12:16 2008
@@ -28,7 +28,7 @@
 #include "inotify-missing.h"
 #include "inotify-path.h"
 
-#define SCAN_MISSING_TIME 4000 /* 1/4 Hz */
+#define SCAN_MISSING_TIME 4 /* 1/4 Hz */
 
 static gboolean im_debug_enabled = FALSE;
 #define IM_W if (im_debug_enabled) g_warning
@@ -71,7 +71,7 @@
   if (!scan_missing_running)
     {
       scan_missing_running = TRUE;
-      g_timeout_add (SCAN_MISSING_TIME, im_scan_missing, NULL);
+      g_timeout_add_seconds (SCAN_MISSING_TIME, im_scan_missing, NULL);
     }
 }
 

Modified: trunk/gio/inotify/inotify-path.c
==============================================================================
--- trunk/gio/inotify/inotify-path.c	(original)
+++ trunk/gio/inotify/inotify-path.c	Mon Jan 21 05:12:16 2008
@@ -112,14 +112,16 @@
 }
 
 static void
-ip_map_path_dir (const char *path, ip_watched_dir_t *dir)
+ip_map_path_dir (const char       *path, 
+                 ip_watched_dir_t *dir)
 {
   g_assert (path && dir);
   g_hash_table_insert (path_dir_hash, dir->path, dir);
 }
 
 static void
-ip_map_sub_dir (inotify_sub *sub, ip_watched_dir_t *dir)
+ip_map_sub_dir (inotify_sub      *sub, 
+                ip_watched_dir_t *dir)
 {
   /* Associate subscription and directory */
   g_assert (dir && sub);
@@ -128,7 +130,8 @@
 }
 
 static void
-ip_map_wd_dir (gint32 wd, ip_watched_dir_t *dir)
+ip_map_wd_dir (gint32            wd, 
+               ip_watched_dir_t *dir)
 {
   GList *dir_list;
   
@@ -161,7 +164,7 @@
   wd = _ik_watch (sub->dirname, IP_INOTIFY_MASK|IN_ONLYDIR, &err);
   if (wd < 0) 
     {
-      IP_W("Failed\n");
+      IP_W ("Failed\n");
       return FALSE;
     }
   else
@@ -182,14 +185,16 @@
 }
 
 static void
-ip_unmap_path_dir (const char *path, ip_watched_dir_t *dir)
+ip_unmap_path_dir (const char       *path, 
+                   ip_watched_dir_t *dir)
 {
   g_assert (path && dir);
   g_hash_table_remove (path_dir_hash, dir->path);
 }
 
 static void
-ip_unmap_wd_dir (gint32 wd, ip_watched_dir_t *dir)
+ip_unmap_wd_dir (gint32            wd, 
+                 ip_watched_dir_t *dir)
 {
   GList *dir_list = g_hash_table_lookup (wd_dir_hash, GINT_TO_POINTER (wd));
   
@@ -216,7 +221,8 @@
 }
 
 static void
-ip_unmap_sub_dir (inotify_sub *sub, ip_watched_dir_t *dir)
+ip_unmap_sub_dir (inotify_sub       *sub, 
+                  ip_watched_dir_t *dir)
 {
   g_assert (sub && dir);
   g_hash_table_remove (sub_dir_hash, sub);
@@ -238,7 +244,7 @@
 }
 
 gboolean
-_ip_stop_watching  (inotify_sub *sub)
+_ip_stop_watching (inotify_sub *sub)
 {
   ip_watched_dir_t *dir = NULL;
   
@@ -262,7 +268,8 @@
 
 
 static ip_watched_dir_t *
-ip_watched_dir_new (const char *path, gint32 wd)
+ip_watched_dir_new (const char *path, 
+                    gint32      wd)
 {
   ip_watched_dir_t *dir = g_new0 (ip_watched_dir_t, 1);
   
@@ -273,7 +280,7 @@
 }
 
 static void
-ip_watched_dir_free (ip_watched_dir_t * dir)
+ip_watched_dir_free (ip_watched_dir_t *dir)
 {
   g_assert (dir->subs == NULL);
   g_free (dir->path);
@@ -281,7 +288,8 @@
 }
 
 static void
-ip_wd_delete (gpointer data, gpointer user_data)
+ip_wd_delete (gpointer data, 
+              gpointer user_data)
 {
   ip_watched_dir_t *dir = data;
   GList *l = NULL;
@@ -299,7 +307,9 @@
 }
 
 static void
-ip_event_dispatch (GList *dir_list, GList* pair_dir_list, ik_event_t *event)
+ip_event_dispatch (GList      *dir_list, 
+                   GList      *pair_dir_list, 
+                   ik_event_t *event)
 {
   GList *dirl;
   

Modified: trunk/gio/inotify/inotify-sub.c
==============================================================================
--- trunk/gio/inotify/inotify-sub.c	(original)
+++ trunk/gio/inotify/inotify-sub.c	Mon Jan 21 05:12:16 2008
@@ -33,9 +33,9 @@
 #define IS_W if (is_debug_enabled) g_warning
 
 static gchar*
-dup_dirname(const gchar* dirname)
+dup_dirname (const gchar *dirname)
 {
-  gchar* d_dirname = g_strdup (dirname);
+  gchar *d_dirname = g_strdup (dirname);
   size_t len = strlen (d_dirname);
   
   if (d_dirname[len] == '/')
@@ -45,9 +45,11 @@
 }
 
 inotify_sub*
-_ih_sub_new (const gchar* dirname, const gchar* filename, gpointer user_data)
+_ih_sub_new (const gchar *dirname, 
+             const gchar *filename, 
+             gpointer     user_data)
 {
-  inotify_sub* sub = NULL;
+  inotify_sub *sub = NULL;
   
   sub = g_new0 (inotify_sub, 1);
   sub->dirname = dup_dirname (dirname);
@@ -60,7 +62,7 @@
 }
 
 void
-_ih_sub_free (inotify_sub* sub)
+_ih_sub_free (inotify_sub *sub)
 {
   g_free (sub->dirname);
   g_free (sub->filename);



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