path: root/path.c
diff options
authorJeff King <>2020-01-30 09:52:19 (GMT)
committerJunio C Hamano <>2020-01-30 21:45:58 (GMT)
commit9734b74a8f9e327e02762024596961209cf989d5 (patch)
treee19e2f23b67a04d6ba2aac53699e2b5b98501663 /path.c
parentd0654dc308b0ba76dd8ed7bbb33c8d8f7aacd783 (diff)
normalize_path_copy(): document "dst" size expectations
We take a "dst" buffer to write into, but there's no matching "len" parameter. The hidden assumption is that normalizing always makes things smaller, so we're OK as long as "dst" is at least as big as "src". Let's document that explicitly. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'path.c')
1 files changed, 2 insertions, 0 deletions
diff --git a/path.c b/path.c
index a76eec8..88cf593 100644
--- a/path.c
+++ b/path.c
@@ -1077,6 +1077,8 @@ const char *remove_leading_path(const char *in, const char *prefix)
* It is okay if dst == src, but they should not overlap otherwise.
+ * The "dst" buffer must be at least as long as "src"; normalizing may shrink
+ * the size of the path, but will never grow it.
* Performs the following normalizations on src, storing the result in dst:
* - Ensures that components are separated by '/' (Windows only)