diff options
author | Alexander Larsson <alexl@src.gnome.org> | 2007-09-13 12:17:11 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2007-09-13 12:17:11 +0000 |
commit | 0a99e0fee5b1bef7874f290a42c1451348d8429b (patch) | |
tree | 212ce983115adf95695ac07514b83c3ce2f5d9bc /common/gmountspec.c | |
parent | 16921fd84a1af1584c4339c6f58e8a3fdf36ce88 (diff) | |
download | gvfs-0a99e0fee5b1bef7874f290a42c1451348d8429b.tar.gz |
Add g_mount_spec_equal and g_mount_spec_hash
Original git commit by Alexander Larsson <alex@greebo.(none)> at 1173803643 +0100
svn path=/trunk/; revision=391
Diffstat (limited to 'common/gmountspec.c')
-rw-r--r-- | common/gmountspec.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/common/gmountspec.c b/common/gmountspec.c index 846bc94e..c48f7962 100644 --- a/common/gmountspec.c +++ b/common/gmountspec.c @@ -289,6 +289,36 @@ path_has_prefix (const char *path, return FALSE; } +guint +g_mount_spec_hash (gconstpointer _mount) +{ + GMountSpec *mount = (GMountSpec *) _mount; + guint hash; + int i; + + hash = 0; + if (mount->mount_prefix) + hash ^= g_str_hash (mount->mount_prefix); + + for (i = 0; i < mount->items->len; i++) + { + GMountSpecItem *item = &g_array_index (mount->items, GMountSpecItem, i); + hash ^= g_str_hash (item->value); + } + + return hash; +} + +gboolean +g_mount_spec_equal (GMountSpec *mount1, + GMountSpec *mount2) +{ + return items_equal (mount1->items, mount2->items) && + ((mount1->mount_prefix == mount2->mount_prefix) || + (mount1->mount_prefix != NULL && mount2->mount_prefix != NULL && + strcmp (mount1->mount_prefix, mount2->mount_prefix) == 0)); +} + gboolean g_mount_spec_match_with_path (GMountSpec *mount, GMountSpec *spec, |