summaryrefslogtreecommitdiff
path: root/src/dired.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-03-28 20:55:18 +0000
committerRichard M. Stallman <rms@gnu.org>1994-03-28 20:55:18 +0000
commit3fcc88cce00da5602c389c643b7aa2a569f2e2d0 (patch)
tree1ffbf3799576a9ba5bb3901f894ddf97b62ee188 /src/dired.c
parent73804d4b1beeb0e5510792396018296c672288b2 (diff)
downloademacs-3fcc88cce00da5602c389c643b7aa2a569f2e2d0.tar.gz
(file_name_completion): Protect things from GC.
Diffstat (limited to 'src/dired.c')
-rw-r--r--src/dired.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dired.c b/src/dired.c
index 8ff38647946..2b2b5dcdf61 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -286,6 +286,8 @@ file_name_completion (file, dirname, all_flag, ver_flag)
int directoryp;
int passcount;
int count = specpdl_ptr - specpdl;
+ struct gcpro gcpro1, gcpro2, gcpro3;
+
#ifdef VMS
extern DIRENTRY * readdirver ();
@@ -305,8 +307,10 @@ file_name_completion (file, dirname, all_flag, ver_flag)
#ifdef FILE_SYSTEM_CASE
file = FILE_SYSTEM_CASE (file);
#endif
- dirname = Fexpand_file_name (dirname, Qnil);
bestmatch = Qnil;
+ dirname = Qnil;
+ GCPRO3 (file, dirname, bestmatch);
+ dirname = Fexpand_file_name (dirname, 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 @@ file_name_completion (file, dirname, all_flag, ver_flag)
closedir (d);
}
- unbind_to (count, Qnil);
+ UNGCPRO;
+ bestmatch = unbind_to (count, bestmatch);
if (all_flag || NILP (bestmatch))
return bestmatch;