chiark / gitweb /
hash-func: add generic hash_ops implementation for hashing paths
authorLennart Poettering <lennart@poettering.net>
Thu, 8 Feb 2018 17:31:15 +0000 (18:31 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:58:53 +0000 (07:58 +0200)
commit96d5ca4f321678a9aeb20a446ba8e35bf79894a1
treeb34f407409a5893265d09305b59acd4b829e424c
parent3a5c777b29f75cb5b129eaec8d8e7a4d5e7024fe
hash-func: add generic hash_ops implementation for hashing paths

This is similar to string_hash_ops but operates one file system paths
specifically. It will ensure that "/foo//bar" and "///foo/bar" are
considered to be the same path for hashmap purposes.

This makes use of the existing path_compare() API, and adds a matching
hashing function for it.

Note that relative and absolute paths will hash to different values,
however whether the path is suffixed with a slash or not is not
detected. This matches the existing path_compare() behaviour, and
follows the logic that on Linux there can't be two different objects at
path /foo/bar and /foo/bar/ either.
src/basic/hash-funcs.h
src/test/test-hashmap.c