Git fork

Merge branch 'js/mingw-tests-2.8'

Code clean-up.

* js/mingw-tests-2.8:
Windows: shorten code by re-using convert_slashes()

+3 -11
+1 -4
abspath.c
··· 167 167 strbuf_add(&path, pfx, pfx_len); 168 168 strbuf_addstr(&path, arg); 169 169 #else 170 - char *p; 171 170 /* don't add prefix to absolute paths, but still replace '\' by '/' */ 172 171 strbuf_reset(&path); 173 172 if (is_absolute_path(arg)) ··· 175 174 else if (pfx_len) 176 175 strbuf_add(&path, pfx, pfx_len); 177 176 strbuf_addstr(&path, arg); 178 - for (p = path.buf + pfx_len; *p; p++) 179 - if (*p == '\\') 180 - *p = '/'; 177 + convert_slashes(path.buf + pfx_len); 181 178 #endif 182 179 return path.buf; 183 180 }
+2 -7
compat/mingw.c
··· 763 763 764 764 char *mingw_getcwd(char *pointer, int len) 765 765 { 766 - int i; 767 766 wchar_t wpointer[MAX_PATH]; 768 767 if (!_wgetcwd(wpointer, ARRAY_SIZE(wpointer))) 769 768 return NULL; 770 769 if (xwcstoutf(pointer, wpointer, len) < 0) 771 770 return NULL; 772 - for (i = 0; pointer[i]; i++) 773 - if (pointer[i] == '\\') 774 - pointer[i] = '/'; 771 + convert_slashes(pointer); 775 772 return pointer; 776 773 } 777 774 ··· 2112 2109 * executable (by not mistaking the dir separators 2113 2110 * for escape characters). 2114 2111 */ 2115 - for (; *tmp; tmp++) 2116 - if (*tmp == '\\') 2117 - *tmp = '/'; 2112 + convert_slashes(tmp); 2118 2113 } 2119 2114 2120 2115 /* simulate TERM to enable auto-color (see color.c) */