From a58854a0311316a66fda363e83665ab942d81ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Mon, 13 Jul 2015 17:11:19 +0200 Subject: submodule, path: extract slash conversion Extract the backslash-to-slash conversion into a helper function. --- src/path.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/path.c') diff --git a/src/path.c b/src/path.c index 2558058dd..16283cab2 100644 --- a/src/path.c +++ b/src/path.c @@ -1671,3 +1671,19 @@ bool git_path_isvalid( return verify_component(repo, start, (c - start), flags); } + +int git_path_normalize_slashes(git_buf *out, const char *path) +{ + int error; + char *p; + + if ((error = git_buf_puts(out, path)) < 0) + return error; + + for (p = out->ptr; *p; p++) { + if (*p == '\\') + *p = '/'; + } + + return 0; +} -- cgit v1.2.1