[glib] poll file monitor: Don't reimplement g_strcmp0
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] poll file monitor: Don't reimplement g_strcmp0
- Date: Fri, 21 Aug 2015 01:11:19 +0000 (UTC)
commit ee31d492d80821ab72d6dd1c8950353ad12d54d0
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Aug 20 21:10:49 2015 -0400
poll file monitor: Don't reimplement g_strcmp0
We have that function now, so use it.
gio/gpollfilemonitor.c | 22 +++-------------------
1 files changed, 3 insertions(+), 19 deletions(-)
---
diff --git a/gio/gpollfilemonitor.c b/gio/gpollfilemonitor.c
index 8e6dc5b..f87649e 100644
--- a/gio/gpollfilemonitor.c
+++ b/gio/gpollfilemonitor.c
@@ -72,20 +72,6 @@ g_poll_file_monitor_init (GPollFileMonitor* poll_monitor)
{
}
-static int
-safe_strcmp (const char *a,
- const char *b)
-{
- if (a == NULL && b == NULL)
- return 0;
- if (a == NULL)
- return -1;
- if (b == NULL)
- return 1;
-
- return strcmp (a, b);
-}
-
static int
calc_event_type (GFileInfo *last,
GFileInfo *new)
@@ -99,12 +85,10 @@ calc_event_type (GFileInfo *last,
if (last != NULL && new == NULL)
return G_FILE_MONITOR_EVENT_DELETED;
- if (safe_strcmp (g_file_info_get_etag (last),
- g_file_info_get_etag (new)))
+ if (g_strcmp0 (g_file_info_get_etag (last), g_file_info_get_etag (new)))
return G_FILE_MONITOR_EVENT_CHANGED;
- if (g_file_info_get_size (last) !=
- g_file_info_get_size (new))
+ if (g_file_info_get_size (last) != g_file_info_get_size (new))
return G_FILE_MONITOR_EVENT_CHANGED;
return -1;
@@ -196,7 +180,7 @@ got_initial_info (GObject *source_object,
}
/**
- * g_poll_file_monitor_new:
+ * _g_poll_file_monitor_new:
* @file: a #GFile.
*
* Polls @file for changes.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]