@@ -373,15 +373,6 @@ static WCHAR* search_path(const WCHAR *file,
373
373
name_has_ext );
374
374
375
375
while (result == NULL ) {
376
- if (* dir_end == L'\0' ) {
377
- break ;
378
- }
379
-
380
- /* Skip the separator that dir_end now points to */
381
- if (dir_end != path ) {
382
- dir_end ++ ;
383
- }
384
-
385
376
/* Next slice starts just after where the previous one ended */
386
377
dir_start = dir_end ;
387
378
@@ -392,27 +383,33 @@ static WCHAR* search_path(const WCHAR *file,
392
383
}
393
384
394
385
/* If the slice is zero-length, don't bother */
395
- if (dir_end - dir_start == 0 ) {
396
- continue ;
386
+ if (dir_end - dir_start > 0 ) {
387
+ dir_path = dir_start ;
388
+ dir_len = dir_end - dir_start ;
389
+
390
+ /* Adjust if the path is quoted. */
391
+ if (dir_path [0 ] == '"' || dir_path [0 ] == '\'' ) {
392
+ ++ dir_path ;
393
+ -- dir_len ;
394
+ }
395
+
396
+ if (dir_path [dir_len - 1 ] == '"' || dir_path [dir_len - 1 ] == '\'' ) {
397
+ -- dir_len ;
398
+ }
399
+
400
+ result = path_search_walk_ext (dir_path , dir_len ,
401
+ file , file_len ,
402
+ cwd , cwd_len ,
403
+ name_has_ext );
397
404
}
398
405
399
- dir_path = dir_start ;
400
- dir_len = dir_end - dir_start ;
401
-
402
- /* Adjust if the path is quoted. */
403
- if (dir_path [0 ] == '"' || dir_path [0 ] == '\'' ) {
404
- ++ dir_path ;
405
- -- dir_len ;
406
- }
407
-
408
- if (dir_path [dir_len - 1 ] == '"' || dir_path [dir_len - 1 ] == '\'' ) {
409
- -- dir_len ;
406
+ /* Stop if reached end of the line */
407
+ if (* dir_end == L'\0' ) {
408
+ break ;
410
409
}
411
-
412
- result = path_search_walk_ext (dir_path , dir_len ,
413
- file , file_len ,
414
- cwd , cwd_len ,
415
- name_has_ext );
410
+
411
+ /* Skip the separator that dir_end now points to */
412
+ dir_end ++ ;
416
413
}
417
414
}
418
415
0 commit comments