summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniof@gnome.org>2023-04-08 21:28:20 +0100
committerAntónio Fernandes <antoniof@gnome.org>2023-04-15 07:28:04 +0000
commited2dbd69b8bbdd98c3c09447087e8015c5d011f0 (patch)
treec41fa1cdb7ff0407af20d71ecbeaca73269335e9
parentf0f6c372802aabe7ba098d3af1f81cbc03eba27b (diff)
downloadnautilus-ed2dbd69b8bbdd98c3c09447087e8015c5d011f0.tar.gz
Revert "nautils-search-engine-tracker: Only parse non-null dates"
This reverts commit 5f1680f9df8d6a62681a878975a1cec75a328a3d. It avoids a warning from g_date_time_new_from_iso8601() by pushing the code flow into another warning. A different solution is to follow.
-rw-r--r--src/nautilus-search-engine-tracker.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/nautilus-search-engine-tracker.c b/src/nautilus-search-engine-tracker.c
index bafc8148b..51917216b 100644
--- a/src/nautilus-search-engine-tracker.c
+++ b/src/nautilus-search-engine-tracker.c
@@ -181,7 +181,7 @@ cursor_callback (GObject *object,
const char *atime_str;
const char *ctime_str;
const gchar *snippet;
- GDateTime *date = NULL;
+ GDateTime *date;
g_autoptr (GTimeZone) tz = g_time_zone_new_local ();
gdouble rank, match;
gboolean success;
@@ -232,40 +232,31 @@ cursor_callback (GObject *object,
}
}
- if (mtime_str != NULL)
- {
- date = g_date_time_new_from_iso8601 (mtime_str, tz);
- }
+ date = g_date_time_new_from_iso8601 (mtime_str, tz);
if (date != NULL)
{
nautilus_search_hit_set_modification_time (hit, date);
- g_clear_pointer (&date, g_date_time_unref);
+ g_date_time_unref (date);
}
else
{
g_warning ("unable to parse mtime: %s", mtime_str);
}
- if (atime_str != NULL)
- {
- date = g_date_time_new_from_iso8601 (atime_str, tz);
- }
+ date = g_date_time_new_from_iso8601 (atime_str, tz);
if (date != NULL)
{
nautilus_search_hit_set_access_time (hit, date);
- g_clear_pointer (&date, g_date_time_unref);
+ g_date_time_unref (date);
}
else
{
g_warning ("unable to parse atime: %s", atime_str);
}
- if (ctime_str != NULL)
- {
- date = g_date_time_new_from_iso8601 (ctime_str, tz);
- }
+ date = g_date_time_new_from_iso8601 (ctime_str, tz);
if (date != NULL)
{
nautilus_search_hit_set_creation_time (hit, date);
- g_clear_pointer (&date, g_date_time_unref);
+ g_date_time_unref (date);
}
else
{