diff options
author | António Fernandes <antoniof@gnome.org> | 2023-04-08 21:28:20 +0100 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2023-04-08 22:29:07 +0100 |
commit | 1135937b60fbf962c473989268887e8dc912567a (patch) | |
tree | 330b97117dd6c8feaafc0ba043fb6ca71d99eb7e | |
parent | f7ccb4e731a337a757d234e5a738a549282ac6b5 (diff) | |
download | nautilus-1135937b60fbf962c473989268887e8dc912567a.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.c | 23 |
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 { |