aboutsummaryrefslogtreecommitdiffstats
path: root/compat/precompose_utf8.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-04-13 15:28:51 -0700
committerJunio C Hamano <gitster@pobox.com>2021-04-13 15:28:51 -0700
commit4c6ac2da2c1da66a3fba429aa983e481c41fa1d0 (patch)
tree2287064be5533324cc3d90ae5ceadee1cfe97412 /compat/precompose_utf8.c
parentMerge branch 'fm/user-manual-use-preface' (diff)
parentmacOS: precompose startup_info->prefix (diff)
downloadgit-4c6ac2da2c1da66a3fba429aa983e481c41fa1d0.tar.gz
git-4c6ac2da2c1da66a3fba429aa983e481c41fa1d0.zip
Merge branch 'tb/precompose-prefix-simplify'
Streamline the codepath to fix the UTF-8 encoding issues in the argv[] and the prefix on macOS. * tb/precompose-prefix-simplify: macOS: precompose startup_info->prefix precompose_utf8: make precompose_string_if_needed() public
Diffstat (limited to 'compat/precompose_utf8.c')
-rw-r--r--compat/precompose_utf8.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c
index ec560565a8..cce1d57a46 100644
--- a/compat/precompose_utf8.c
+++ b/compat/precompose_utf8.c
@@ -60,10 +60,12 @@ void probe_utf8_pathname_composition(void)
strbuf_release(&path);
}
-static inline const char *precompose_string_if_needed(const char *in)
+const char *precompose_string_if_needed(const char *in)
{
size_t inlen;
size_t outlen;
+ if (!in)
+ return NULL;
if (has_non_ascii(in, (size_t)-1, &inlen)) {
iconv_t ic_prec;
char *out;
@@ -96,10 +98,7 @@ const char *precompose_argv_prefix(int argc, const char **argv, const char *pref
argv[i] = precompose_string_if_needed(argv[i]);
i++;
}
- if (prefix) {
- prefix = precompose_string_if_needed(prefix);
- }
- return prefix;
+ return precompose_string_if_needed(prefix);
}