comparison src/fileio.c @ 45551:811d06e337cb

(Fread_file_name_internal): Added brute-force speed up for using predicate file-directory-p.
author Kim F. Storm <storm@cua.dk>
date Tue, 28 May 2002 09:03:22 +0000
parents b8f71d4c359f
children 54b933234eb4
comparison
equal deleted inserted replaced
45550:acd09cfa0ecd 45551:811d06e337cb
5909 int count; 5909 int count;
5910 5910
5911 if (NILP (Vread_file_name_predicate) 5911 if (NILP (Vread_file_name_predicate)
5912 || EQ (Vread_file_name_predicate, Qfile_exists_p)) 5912 || EQ (Vread_file_name_predicate, Qfile_exists_p))
5913 return all; 5913 return all;
5914 GCPRO3 (all, comp, specdir); 5914
5915 count = specpdl_ptr - specpdl; 5915 #ifndef VMS
5916 record_unwind_protect (read_file_name_cleanup, current_buffer->directory); 5916 if (EQ (Vread_file_name_predicate, Qfile_directory_p))
5917 current_buffer->directory = realdir; 5917 {
5918 for (comp = Qnil; CONSP (all); all = XCDR (all)) 5918 /* Brute-force speed up for directory checking:
5919 if (!NILP (call1 (Vread_file_name_predicate, XCAR (all)))) 5919 Discard strings which don't end in a slash. */
5920 comp = Fcons (XCAR (all), comp); 5920 for (comp = Qnil; CONSP (all); all = XCDR (all))
5921 unbind_to (count, Qnil); 5921 {
5922 UNGCPRO; 5922 Lisp_Object tem = XCAR (all);
5923 int len;
5924 if (STRINGP (tem) &&
5925 (len = XSTRING (tem)->size, len > 0) &&
5926 IS_DIRECTORY_SEP (XSTRING (tem)->data[len-1]))
5927 comp = Fcons (tem, comp);
5928 }
5929 }
5930 else
5931 #endif
5932 {
5933 /* Must do it the hard (and slow) way. */
5934 GCPRO3 (all, comp, specdir);
5935 count = specpdl_ptr - specpdl;
5936 record_unwind_protect (read_file_name_cleanup, current_buffer->directory);
5937 current_buffer->directory = realdir;
5938 for (comp = Qnil; CONSP (all); all = XCDR (all))
5939 if (!NILP (call1 (Vread_file_name_predicate, XCAR (all))))
5940 comp = Fcons (XCAR (all), comp);
5941 unbind_to (count, Qnil);
5942 UNGCPRO;
5943 }
5923 return Fnreverse (comp); 5944 return Fnreverse (comp);
5924 } 5945 }
5925 5946
5926 /* Only other case actually used is ACTION = lambda */ 5947 /* Only other case actually used is ACTION = lambda */
5927 #ifdef VMS 5948 #ifdef VMS