summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-30 10:21:29 -0400
committerSven Eden <yamakuzure@gmx.net>2017-07-05 08:50:56 +0200
commit1e2c11636861da69c5637e59afe207a11dd4f386 (patch)
treeacdbaaceed2467740e41a670b15013e80848f3e4 /src/basic
parent32694ef587f2b66736d0066e4e22ab2c150023c7 (diff)
tests: clarify test_path_startswith return value (#4508)
A pendant for #4481.
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/path-util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/basic/path-util.c b/src/basic/path-util.c
index cdbb2d398..3af95bf24 100644
--- a/src/basic/path-util.c
+++ b/src/basic/path-util.c
@@ -356,6 +356,16 @@ char* path_startswith(const char *path, const char *prefix) {
assert(path);
assert(prefix);
+ /* Returns a pointer to the start of the first component after the parts matched by
+ * the prefix, iff
+ * - both paths are absolute or both paths are relative,
+ * and
+ * - each component in prefix in turn matches a component in path at the same position.
+ * An empty string will be returned when the prefix and path are equivalent.
+ *
+ * Returns NULL otherwise.
+ */
+
if ((path[0] == '/') != (prefix[0] == '/'))
return NULL;