[tracker/tracker-0.6] Make tracker_hal_path_is_on_removable_device() a bit more performant.
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker/tracker-0.6] Make tracker_hal_path_is_on_removable_device() a bit more performant.
- Date: Mon, 4 May 2009 12:02:11 -0400 (EDT)
commit 146b64aef8d3c53f71a1db3e5f6ab30304f4ddea
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon May 4 17:56:58 2009 +0200
Make tracker_hal_path_is_on_removable_device() a bit more performant.
---
src/libtracker-common/tracker-hal.c | 39 ++++++++++------------------------
1 files changed, 12 insertions(+), 27 deletions(-)
diff --git a/src/libtracker-common/tracker-hal.c b/src/libtracker-common/tracker-hal.c
index 7d9d713..ff32af1 100644
--- a/src/libtracker-common/tracker-hal.c
+++ b/src/libtracker-common/tracker-hal.c
@@ -1181,39 +1181,24 @@ tracker_hal_path_is_on_removable_device (TrackerHal *hal,
g_hash_table_iter_init (&iter, priv->removable_devices);
while (g_hash_table_iter_next (&iter, &key, &value)) {
- LibHalVolume *volume;
- const gchar *udi;
- const gchar *mp;
+ const gchar *mp;
- udi = key;
+ mp = value;
- volume = libhal_volume_from_udi (priv->context, udi);
+ if (mp && path &&
+ g_str_has_prefix (path, mp)) {
+ found = TRUE;
- if (!volume) {
- g_message ("HAL device with udi:'%s' has no volume, "
- "should we delete?",
- udi);
- continue;
- }
-
- mp = libhal_volume_get_mount_point (volume);
-
- if (g_strcmp0 (mp, path) != 0) {
- if (g_strrstr (path, mp)) {
- found = TRUE;
-
- if (mount_point)
- *mount_point = g_strdup (mp);
-
- if (available)
- *available = libhal_volume_is_mounted (volume);
+ if (mount_point) {
+ *mount_point = g_strdup (mp);
+ }
- libhal_volume_free (volume);
- break;
+ if (available) {
+ *available = TRUE;
}
- }
- libhal_volume_free (volume);
+ break;
+ }
}
return found;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]