Re: [PATCH] cleanup precompose_utf8

2012-08-19 Thread Torsten Bögershausen
On 17.08.12 19:30, Junio C Hamano wrote:
 Robin Rosenberg robin.rosenb...@dewire.com writes:

 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
 ---
 Thanks.  I've found and fixed a bit more style violations while we
 are at it.

(I was offline for a couple of days)

Thanks to all, and ACK from my side.
/Torsten



--
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


[PATCH] cleanup precompose_utf8

2012-08-17 Thread Robin Rosenberg
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


Re: [PATCH] cleanup precompose_utf8

2012-08-17 Thread Junio C Hamano
Thanks.
--
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


Re: [PATCH] cleanup precompose_utf8

2012-08-17 Thread Junio C Hamano
Robin Rosenberg robin.rosenb...@dewire.com writes:

 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
 ---

Thanks.  I've found and fixed a bit more style violations while we
are at it.
--
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