diff options
author | Karl Berry <karl@freefriends.org> | 2018-01-05 18:51:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-01-05 18:51:32 +0000 |
commit | eb7e0d36e245468c3807679b1caa95ae8f592102 (patch) | |
tree | dc48a4933737d36f5bfcfa36ec90a2ccb079ab2b /Build/source | |
parent | 33f49ed632b30997a4f61266ebea2d401ad9b065 (diff) |
continue loops with original next element
git-svn-id: svn://tug.org/texlive/trunk@46222 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/kpathsea/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/pathsearch.c | 13 |
2 files changed, 17 insertions, 3 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 1511b4a0621..a57bcff5467 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,10 @@ +2018-01-05 Karl Berry <karl@freefriends.org> + + * pathsearch.c (dir_list_search, dir_list_search_list): save the + next element to continue the loop, in case the + current element floats. Report from Douglas McKenna, + tex-k mail 4 Jan 2018 10:16:18. + 2017-12-27 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * xbasename.c, xdirname.c: Remove IS_KANJI test for UNC names, diff --git a/Build/source/texk/kpathsea/pathsearch.c b/Build/source/texk/kpathsea/pathsearch.c index 0f59ac5ed95..4f57c116191 100644 --- a/Build/source/texk/kpathsea/pathsearch.c +++ b/Build/source/texk/kpathsea/pathsearch.c @@ -1,6 +1,6 @@ /* pathsearch.c: look up a filename in a path. - Copyright 1993, 1994, 1995, 1997, 2007, 2009-2012 Karl Berry. + Copyright 1993, 1994, 1995, 1997, 2007, 2009-2012, 2018 Karl Berry. Copyright 1997-2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -117,6 +117,7 @@ dir_list_search (kpathsea kpse, str_llist_type *dirs, const_string name, boolean search_all) { str_llist_elt_type *elt; + str_llist_elt_type *next_elt; str_list_type ret; unsigned name_len = strlen (name); unsigned allocated = INIT_ALLOC; @@ -124,11 +125,13 @@ dir_list_search (kpathsea kpse, str_llist_type *dirs, const_string name, ret = str_list_init (); - for (elt = *dirs; elt; elt = STR_LLIST_NEXT (*elt)) + for (elt = *dirs; elt; elt = next_elt) { const_string dir = STR_LLIST (*elt); unsigned dir_len = strlen (dir); + next_elt = STR_LLIST_NEXT (*elt); /* in case elt floats */ + while (dir_len + name_len + 1 > allocated) { allocated += allocated; @@ -165,22 +168,26 @@ dir_list_search (kpathsea kpse, str_llist_type *dirs, const_string name, } /* Note: NAMES[i] is not modified. */ + static str_list_type dir_list_search_list (kpathsea kpse, str_llist_type *dirs, string* names, boolean search_all) { str_llist_elt_type *elt; + str_llist_elt_type *next_elt; str_list_type ret; unsigned allocated = INIT_ALLOC; string potential = XTALLOC(allocated, char); ret = str_list_init (); - for (elt = *dirs; elt; elt = STR_LLIST_NEXT(*elt)) { + for (elt = *dirs; elt; elt = next_elt) { const_string dir = STR_LLIST (*elt); unsigned dir_len = strlen (dir); int i; + next_elt = STR_LLIST_NEXT (*elt); /* in case elt floats */ + for (i = 0; names[i]; i++) { const_string name = names[i]; unsigned name_len; |