/* Lisp functions for making directory listings.
- Copyright (C) 1985-1986, 1993-1994, 1999-2014 Free Software
+ Copyright (C) 1985-1986, 1993-1994, 1999-2015 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
#include "regex.h"
#include "blockinput.h"
-static Lisp_Object Qdirectory_files;
-static Lisp_Object Qdirectory_files_and_attributes;
-static Lisp_Object Qfile_name_completion;
-static Lisp_Object Qfile_name_all_completions;
-static Lisp_Object Qfile_attributes;
-static Lisp_Object Qfile_attributes_lessp;
+#ifdef MSDOS
+#include "msdos.h" /* for fstatat */
+#endif
static ptrdiff_t scmp (const char *, const char *, ptrdiff_t);
static Lisp_Object file_attributes (int, char const *, Lisp_Object);
Lisp_Object w32_save = Qnil;
#endif
+ /* Don't let the compiler optimize away all copies of DIRECTORY,
+ which would break GC; see Bug#16986. Although this is required
+ only in the common case where GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS,
+ it shouldn't break anything in the other cases. */
+ Lisp_Object volatile directory_volatile = directory;
+
/* Because of file name handlers, these functions might call
Ffuncall, and cause a GC. */
list = encoded_directory = dirfilename = Qnil;
list = Fsort (Fnreverse (list),
attrs ? Qfile_attributes_lessp : Qstring_lessp);
+ (void) directory_volatile;
RETURN_UNGCPRO (list);
}
}
static int file_name_completion_stat (int, struct dirent *, struct stat *);
-static Lisp_Object Qdefault_directory;
static Lisp_Object
file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
Lisp_Object encoded;
Lisp_Object handler;
- filename = Fexpand_file_name (filename, Qnil);
+ filename = internal_condition_case_2 (Fexpand_file_name, filename, Qnil,
+ Qt, Fidentity);
+ if (!STRINGP (filename))
+ return Qnil;
/* If the file name has special constructs in it,
call the corresponding file handler. */