changeset 6559:3d314bef071a

(file_name_completion): Protect things from GC.
author Richard M. Stallman <rms@gnu.org>
date Mon, 28 Mar 1994 20:55:18 +0000
parents fa8ff07eaafc
children a071babfa9ea
files src/dired.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/dired.c	Mon Mar 28 20:21:44 1994 +0000
+++ b/src/dired.c	Mon Mar 28 20:55:18 1994 +0000
@@ -286,6 +286,8 @@
   int directoryp;
   int passcount;
   int count = specpdl_ptr - specpdl;
+  struct gcpro gcpro1, gcpro2, gcpro3;
+
 #ifdef VMS
   extern DIRENTRY * readdirver ();
 
@@ -305,8 +307,10 @@
 #ifdef FILE_SYSTEM_CASE
   file = FILE_SYSTEM_CASE (file);
 #endif
+  bestmatch = Qnil;
+  dirname = Qnil;
+  GCPRO3 (file, dirname, bestmatch);
   dirname = Fexpand_file_name (dirname, Qnil);
-  bestmatch = Qnil;
 
   /* With passcount = 0, ignore files that end in an ignored extension.
      If nothing found then try again with passcount = 1, don't ignore them.
@@ -451,7 +455,8 @@
       closedir (d);
     }
 
-  unbind_to (count, Qnil);
+  UNGCPRO;
+  bestmatch = unbind_to (count, bestmatch);
 
   if (all_flag || NILP (bestmatch))
     return bestmatch;