mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
poll file monitor: Don't reimplement g_strcmp0
We have that function now, so use it.
This commit is contained in:
parent
09b618f0a1
commit
ee31d492d8
@ -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
|
static int
|
||||||
calc_event_type (GFileInfo *last,
|
calc_event_type (GFileInfo *last,
|
||||||
GFileInfo *new)
|
GFileInfo *new)
|
||||||
@ -99,12 +85,10 @@ calc_event_type (GFileInfo *last,
|
|||||||
if (last != NULL && new == NULL)
|
if (last != NULL && new == NULL)
|
||||||
return G_FILE_MONITOR_EVENT_DELETED;
|
return G_FILE_MONITOR_EVENT_DELETED;
|
||||||
|
|
||||||
if (safe_strcmp (g_file_info_get_etag (last),
|
if (g_strcmp0 (g_file_info_get_etag (last), g_file_info_get_etag (new)))
|
||||||
g_file_info_get_etag (new)))
|
|
||||||
return G_FILE_MONITOR_EVENT_CHANGED;
|
return G_FILE_MONITOR_EVENT_CHANGED;
|
||||||
|
|
||||||
if (g_file_info_get_size (last) !=
|
if (g_file_info_get_size (last) != g_file_info_get_size (new))
|
||||||
g_file_info_get_size (new))
|
|
||||||
return G_FILE_MONITOR_EVENT_CHANGED;
|
return G_FILE_MONITOR_EVENT_CHANGED;
|
||||||
|
|
||||||
return -1;
|
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.
|
* @file: a #GFile.
|
||||||
*
|
*
|
||||||
* Polls @file for changes.
|
* Polls @file for changes.
|
||||||
|
Loading…
Reference in New Issue
Block a user