comparison src/dired.c @ 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 ededb7b52564
children 97cde7ba7bcb
comparison
equal deleted inserted replaced
6558:fa8ff07eaafc 6559:3d314bef071a
284 Lisp_Object bestmatch, tem, elt, name; 284 Lisp_Object bestmatch, tem, elt, name;
285 struct stat st; 285 struct stat st;
286 int directoryp; 286 int directoryp;
287 int passcount; 287 int passcount;
288 int count = specpdl_ptr - specpdl; 288 int count = specpdl_ptr - specpdl;
289 struct gcpro gcpro1, gcpro2, gcpro3;
290
289 #ifdef VMS 291 #ifdef VMS
290 extern DIRENTRY * readdirver (); 292 extern DIRENTRY * readdirver ();
291 293
292 DIRENTRY *((* readfunc) ()); 294 DIRENTRY *((* readfunc) ());
293 295
303 #endif /* not VMS */ 305 #endif /* not VMS */
304 306
305 #ifdef FILE_SYSTEM_CASE 307 #ifdef FILE_SYSTEM_CASE
306 file = FILE_SYSTEM_CASE (file); 308 file = FILE_SYSTEM_CASE (file);
307 #endif 309 #endif
310 bestmatch = Qnil;
311 dirname = Qnil;
312 GCPRO3 (file, dirname, bestmatch);
308 dirname = Fexpand_file_name (dirname, Qnil); 313 dirname = Fexpand_file_name (dirname, Qnil);
309 bestmatch = Qnil;
310 314
311 /* With passcount = 0, ignore files that end in an ignored extension. 315 /* With passcount = 0, ignore files that end in an ignored extension.
312 If nothing found then try again with passcount = 1, don't ignore them. 316 If nothing found then try again with passcount = 1, don't ignore them.
313 If looking for all completions, start with passcount = 1, 317 If looking for all completions, start with passcount = 1,
314 so always take even the ignored ones. 318 so always take even the ignored ones.
449 } 453 }
450 } 454 }
451 closedir (d); 455 closedir (d);
452 } 456 }
453 457
454 unbind_to (count, Qnil); 458 UNGCPRO;
459 bestmatch = unbind_to (count, bestmatch);
455 460
456 if (all_flag || NILP (bestmatch)) 461 if (all_flag || NILP (bestmatch))
457 return bestmatch; 462 return bestmatch;
458 if (matchcount == 1 && bestmatchsize == XSTRING (file)->size) 463 if (matchcount == 1 && bestmatchsize == XSTRING (file)->size)
459 return Qt; 464 return Qt;