Unified · Split
| @@ -34,6 +34,10 @@ ST_DATA struct TCCState *tcc_state; · 33 unmodified lines | ||
| 34 | 34 | |
| 35 | 35 | /********************************************************/ |
| 36 | 36 | |
| 37 | +#ifndef _WIN32 | |
| 38 | +#include <limits.h> | |
| 39 | +#endif | |
| 40 | + | |
| 37 | 41 | #ifdef ONE_SOURCE |
| 38 | 42 | #include "tccpp.c" |
| 39 | 43 | #include "tccgen.c" |
| @@ -318,7 +322,30 @@ static void tcc_split_path(TCCState *s, void ***p_ary, int *p_nb_ary, const char · 278 unmodified lines | ||
| 318 | 322 | } |
| 319 | 323 | } |
| 320 | 324 | cstr_ccat(&str, '\0'); |
| 325 | +#ifndef _WIN32 | |
| 326 | + { | |
| 327 | + int i, do_include; | |
| 328 | + char tmp[PATH_MAX]; | |
| 329 | + | |
| 330 | + if (realpath(str.data, tmp)) { | |
| 331 | + str.size = 0; | |
| 332 | + cstr_cat(&str, tmp); | |
| 333 | + cstr_ccat(&str, '\0'); | |
| 334 | + } | |
| 335 | + | |
| 336 | + do_include = 1; | |
| 337 | + for (i = 0; i < *p_nb_ary && do_include; i++) { | |
| 338 | + do_include = do_include && | |
| 339 | + strcmp((char*)str.data, (char*)(*p_ary)[i]); | |
| 340 | + } | |
| 341 | + | |
| 342 | + if (do_include) { | |
| 343 | + dynarray_add(p_ary, p_nb_ary, str.data); | |
| 344 | + } | |
| 345 | + } | |
| 346 | +#else | |
| 321 | 347 | dynarray_add(p_ary, p_nb_ary, str.data); |
| 348 | +#endif | |
| 322 | 349 | in = p+1; |
| 323 | 350 | } while (*p); |
| 324 | 351 | } |