mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-13 06:00:36 +01:00
Coding style fixes
svn path=/trunk/; revision=6337
This commit is contained in:
parent
d16037e0e7
commit
a043325ec1
@ -1,3 +1,9 @@
|
|||||||
|
2008-01-20 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* inotify/*.c: Coding style fixes.
|
||||||
|
* inotify/inotify-missing.c: Use g_timeout_add_seconds
|
||||||
|
for the 1/4 Hz timer.
|
||||||
|
|
||||||
2008-01-20 Matthias Clasen <mclasen@redhat.com>
|
2008-01-20 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gfile.c:
|
* gfile.c:
|
||||||
|
@ -50,7 +50,7 @@ g_inotify_directory_monitor_finalize (GObject *object)
|
|||||||
GInotifyDirectoryMonitor *inotify_monitor = G_INOTIFY_DIRECTORY_MONITOR (object);
|
GInotifyDirectoryMonitor *inotify_monitor = G_INOTIFY_DIRECTORY_MONITOR (object);
|
||||||
inotify_sub *sub = inotify_monitor->sub;
|
inotify_sub *sub = inotify_monitor->sub;
|
||||||
|
|
||||||
if (inotify_monitor->sub)
|
if (sub)
|
||||||
{
|
{
|
||||||
_ih_sub_cancel (sub);
|
_ih_sub_cancel (sub);
|
||||||
_ih_sub_free (sub);
|
_ih_sub_free (sub);
|
||||||
@ -124,7 +124,6 @@ g_inotify_directory_monitor_class_init (GInotifyDirectoryMonitorClass* klass)
|
|||||||
static void
|
static void
|
||||||
g_inotify_directory_monitor_init (GInotifyDirectoryMonitor* monitor)
|
g_inotify_directory_monitor_init (GInotifyDirectoryMonitor* monitor)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -133,7 +132,8 @@ g_inotify_directory_monitor_cancel (GFileMonitor* monitor)
|
|||||||
GInotifyDirectoryMonitor *inotify_monitor = G_INOTIFY_DIRECTORY_MONITOR (monitor);
|
GInotifyDirectoryMonitor *inotify_monitor = G_INOTIFY_DIRECTORY_MONITOR (monitor);
|
||||||
inotify_sub *sub = inotify_monitor->sub;
|
inotify_sub *sub = inotify_monitor->sub;
|
||||||
|
|
||||||
if (sub) {
|
if (sub)
|
||||||
|
{
|
||||||
_ih_sub_cancel (sub);
|
_ih_sub_cancel (sub);
|
||||||
_ih_sub_free (sub);
|
_ih_sub_free (sub);
|
||||||
inotify_monitor->sub = NULL;
|
inotify_monitor->sub = NULL;
|
||||||
|
@ -52,7 +52,7 @@ g_inotify_file_monitor_finalize (GObject *object)
|
|||||||
GInotifyFileMonitor *inotify_monitor = G_INOTIFY_FILE_MONITOR (object);
|
GInotifyFileMonitor *inotify_monitor = G_INOTIFY_FILE_MONITOR (object);
|
||||||
inotify_sub *sub = inotify_monitor->sub;
|
inotify_sub *sub = inotify_monitor->sub;
|
||||||
|
|
||||||
if (inotify_monitor->sub)
|
if (sub)
|
||||||
{
|
{
|
||||||
_ih_sub_cancel (sub);
|
_ih_sub_cancel (sub);
|
||||||
_ih_sub_free (sub);
|
_ih_sub_free (sub);
|
||||||
@ -142,7 +142,6 @@ g_inotify_file_monitor_class_init (GInotifyFileMonitorClass* klass)
|
|||||||
static void
|
static void
|
||||||
g_inotify_file_monitor_init (GInotifyFileMonitor* monitor)
|
g_inotify_file_monitor_init (GInotifyFileMonitor* monitor)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -151,7 +150,8 @@ g_inotify_file_monitor_cancel (GFileMonitor* monitor)
|
|||||||
GInotifyFileMonitor *inotify_monitor = G_INOTIFY_FILE_MONITOR (monitor);
|
GInotifyFileMonitor *inotify_monitor = G_INOTIFY_FILE_MONITOR (monitor);
|
||||||
inotify_sub *sub = inotify_monitor->sub;
|
inotify_sub *sub = inotify_monitor->sub;
|
||||||
|
|
||||||
if (sub) {
|
if (sub)
|
||||||
|
{
|
||||||
_ih_sub_cancel (sub);
|
_ih_sub_cancel (sub);
|
||||||
_ih_sub_free (sub);
|
_ih_sub_free (sub);
|
||||||
inotify_monitor->sub = NULL;
|
inotify_monitor->sub = NULL;
|
||||||
|
@ -150,7 +150,8 @@ _ih_sub_cancel (inotify_sub * sub)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ih_event_callback (ik_event_t *event, inotify_sub *sub)
|
ih_event_callback (ik_event_t *event,
|
||||||
|
inotify_sub *sub)
|
||||||
{
|
{
|
||||||
gchar *fullpath;
|
gchar *fullpath;
|
||||||
GFileMonitorEvent eflags;
|
GFileMonitorEvent eflags;
|
||||||
|
@ -146,7 +146,8 @@ ik_source_check (GSource *source)
|
|||||||
goto do_read;
|
goto do_read;
|
||||||
|
|
||||||
/* With each successive iteration, the minimum rate for
|
/* With each successive iteration, the minimum rate for
|
||||||
* further sleep doubles. */
|
* further sleep doubles.
|
||||||
|
*/
|
||||||
if (pending-prev_pending < PENDING_MARGINAL_COST (pending_count))
|
if (pending-prev_pending < PENDING_MARGINAL_COST (pending_count))
|
||||||
goto do_read;
|
goto do_read;
|
||||||
|
|
||||||
@ -265,7 +266,9 @@ ik_event_new (char *buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ik_event_t *
|
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->wd = wd;
|
||||||
@ -291,7 +294,9 @@ _ik_event_free (ik_event_t *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gint32
|
gint32
|
||||||
_ik_watch (const char *path, guint32 mask, int *err)
|
_ik_watch (const char *path,
|
||||||
|
guint32 mask,
|
||||||
|
int *err)
|
||||||
{
|
{
|
||||||
gint32 wd = -1;
|
gint32 wd = -1;
|
||||||
|
|
||||||
@ -314,7 +319,8 @@ _ik_watch (const char *path, guint32 mask, int *err)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_ik_ignore(const char *path, gint32 wd)
|
_ik_ignore (const char *path,
|
||||||
|
gint32 wd)
|
||||||
{
|
{
|
||||||
g_assert (wd >= 0);
|
g_assert (wd >= 0);
|
||||||
g_assert (inotify_instance_fd >= 0);
|
g_assert (inotify_instance_fd >= 0);
|
||||||
@ -330,7 +336,8 @@ _ik_ignore(const char *path, gint32 wd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_ik_move_stats (guint32 *matches, guint32 *misses)
|
_ik_move_stats (guint32 *matches,
|
||||||
|
guint32 *misses)
|
||||||
{
|
{
|
||||||
if (matches)
|
if (matches)
|
||||||
*matches = ik_move_matches;
|
*matches = ik_move_matches;
|
||||||
@ -421,7 +428,8 @@ _ik_mask_to_string (guint32 mask)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
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 gchar *buffer = NULL;
|
||||||
static gsize buffer_size;
|
static gsize buffer_size;
|
||||||
@ -480,7 +488,8 @@ ik_read_callback (gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
g_timeval_lt (GTimeVal *val1, GTimeVal *val2)
|
g_timeval_lt (GTimeVal *val1,
|
||||||
|
GTimeVal *val2)
|
||||||
{
|
{
|
||||||
if (val1->tv_sec < val2->tv_sec)
|
if (val1->tv_sec < val2->tv_sec)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -496,13 +505,15 @@ g_timeval_lt (GTimeVal *val1, GTimeVal *val2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
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);
|
return (val1->tv_sec == val2->tv_sec) && (val1->tv_usec == val2->tv_usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
g_assert (event1 && event2);
|
||||||
/* We should only be pairing events that have the same cookie */
|
/* We should only be pairing events that have the same cookie */
|
||||||
@ -521,7 +532,8 @@ ik_pair_events (ik_event_internal_t *event1, ik_event_internal_t *event2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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_assert (event);
|
||||||
g_time_val_add (&event->hold_until, ms);
|
g_time_val_add (&event->hold_until, ms);
|
||||||
@ -549,7 +561,8 @@ ik_event_ready (ik_event_internal_t *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
ik_event_internal_t *event = (ik_event_internal_t *)data;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "inotify-missing.h"
|
#include "inotify-missing.h"
|
||||||
#include "inotify-path.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;
|
static gboolean im_debug_enabled = FALSE;
|
||||||
#define IM_W if (im_debug_enabled) g_warning
|
#define IM_W if (im_debug_enabled) g_warning
|
||||||
@ -71,7 +71,7 @@ _im_add (inotify_sub *sub)
|
|||||||
if (!scan_missing_running)
|
if (!scan_missing_running)
|
||||||
{
|
{
|
||||||
scan_missing_running = TRUE;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,14 +112,16 @@ _ip_startup (void (*cb)(ik_event_t *event, inotify_sub *sub))
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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_assert (path && dir);
|
||||||
g_hash_table_insert (path_dir_hash, dir->path, dir);
|
g_hash_table_insert (path_dir_hash, dir->path, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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 */
|
/* Associate subscription and directory */
|
||||||
g_assert (dir && sub);
|
g_assert (dir && sub);
|
||||||
@ -128,7 +130,8 @@ ip_map_sub_dir (inotify_sub *sub, ip_watched_dir_t *dir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
GList *dir_list;
|
||||||
|
|
||||||
@ -182,14 +185,16 @@ _ip_start_watching (inotify_sub *sub)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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_assert (path && dir);
|
||||||
g_hash_table_remove (path_dir_hash, dir->path);
|
g_hash_table_remove (path_dir_hash, dir->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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));
|
GList *dir_list = g_hash_table_lookup (wd_dir_hash, GINT_TO_POINTER (wd));
|
||||||
|
|
||||||
@ -216,7 +221,8 @@ ip_unmap_wd (gint32 wd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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_assert (sub && dir);
|
||||||
g_hash_table_remove (sub_dir_hash, sub);
|
g_hash_table_remove (sub_dir_hash, sub);
|
||||||
@ -262,7 +268,8 @@ _ip_stop_watching (inotify_sub *sub)
|
|||||||
|
|
||||||
|
|
||||||
static ip_watched_dir_t *
|
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);
|
ip_watched_dir_t *dir = g_new0 (ip_watched_dir_t, 1);
|
||||||
|
|
||||||
@ -281,7 +288,8 @@ ip_watched_dir_free (ip_watched_dir_t * dir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ip_wd_delete (gpointer data, gpointer user_data)
|
ip_wd_delete (gpointer data,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
ip_watched_dir_t *dir = data;
|
ip_watched_dir_t *dir = data;
|
||||||
GList *l = NULL;
|
GList *l = NULL;
|
||||||
@ -299,7 +307,9 @@ ip_wd_delete (gpointer data, gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
GList *dirl;
|
||||||
|
|
||||||
|
@ -45,7 +45,9 @@ dup_dirname(const gchar* dirname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inotify_sub*
|
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;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user