Remove extraneous parentheses and braces
Remove redundant NUL-termination
Check result of unlink when probing for decomposed file names
Signed-off-by: Robin Rosenberg robin.rosenb...@dewire.com
---
compat/precompose_utf8.c | 11 ---
1 fil ändrad, 4 tillägg(+), 7 borttagningar(-)
diff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c
index d40d1b3..9563760 100644
--- a/compat/precompose_utf8.c
+++ b/compat/precompose_utf8.c
@@ -21,11 +21,10 @@ static size_t has_utf8(const char *s, size_t maxlen, size_t
*strlen_c)
size_t strlen_chars = 0;
size_t ret = 0;
- if ((!utf8p) || (!*utf8p)) {
+ if (!utf8p || !*utf8p)
return 0;
- }
- while((*utf8p) maxlen) {
+ while(*utf8p maxlen) {
if (*utf8p 0x80)
ret++;
strlen_chars++;
@@ -46,21 +45,19 @@ void probe_utf8_pathname_composition(char *path, int len)
int output_fd;
if (precomposed_unicode != -1)
return; /* We found it defined in the global config, respect it
*/
- path[len] = 0;
strcpy(path + len, auml_nfc);
output_fd = open(path, O_CREAT|O_EXCL|O_RDWR, 0600);
if (output_fd =0) {
close(output_fd);
- path[len] = 0;
strcpy(path + len, auml_nfd);
/* Indicate to the user, that we can configure it to true */
if (0 == access(path, R_OK))
git_config_set(core.precomposeunicode, false);
/* To be backward compatible, set precomposed_unicode
to 0 */
precomposed_unicode = 0;
- path[len] = 0;
strcpy(path + len, auml_nfc);
- unlink(path);
+ if (unlink(path))
+ die_errno(_(failed to unlink '%s'), path);
}
}
--
1.7.12.rc3.4.ga867a5c
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html