texlive[46222] Build/source/texk/kpathsea: continue loops with

commits+karl at tug.org commits+karl at tug.org
Fri Jan 5 19:51:32 CET 2018


Revision: 46222
          http://tug.org/svn/texlive?view=revision&revision=46222
Author:   karl
Date:     2018-01-05 19:51:32 +0100 (Fri, 05 Jan 2018)
Log Message:
-----------
continue loops with original next element

Modified Paths:
--------------
    trunk/Build/source/texk/kpathsea/ChangeLog
    trunk/Build/source/texk/kpathsea/pathsearch.c

Modified: trunk/Build/source/texk/kpathsea/ChangeLog
===================================================================
--- trunk/Build/source/texk/kpathsea/ChangeLog	2018-01-05 18:31:08 UTC (rev 46221)
+++ trunk/Build/source/texk/kpathsea/ChangeLog	2018-01-05 18:51:32 UTC (rev 46222)
@@ -1,3 +1,10 @@
+2018-01-05  Karl Berry  <karl at 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 at fuk.kindai.ac.jp>
 
 	* xbasename.c, xdirname.c: Remove IS_KANJI test for UNC names,

Modified: trunk/Build/source/texk/kpathsea/pathsearch.c
===================================================================
--- trunk/Build/source/texk/kpathsea/pathsearch.c	2018-01-05 18:31:08 UTC (rev 46221)
+++ trunk/Build/source/texk/kpathsea/pathsearch.c	2018-01-05 18:51:32 UTC (rev 46222)
@@ -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 @@
                     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 @@
 
   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,11 +168,13 @@
 }
 

 /* 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);
@@ -176,11 +181,13 @@
 
   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;



More information about the tex-live-commits mailing list