aboutsummaryrefslogtreecommitdiffstats
path: root/src/dired.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dired.c')
-rw-r--r--src/dired.c52
1 files changed, 20 insertions, 32 deletions
diff --git a/src/dired.c b/src/dired.c
index 96063680d4d..176f14925b4 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -79,11 +79,6 @@ extern struct direct *readdir (DIR *);
79#include "regex.h" 79#include "regex.h"
80#include "blockinput.h" 80#include "blockinput.h"
81 81
82/* Returns a search buffer, with a fastmap allocated and ready to go. */
83extern struct re_pattern_buffer *compile_pattern (Lisp_Object,
84 struct re_registers *,
85 Lisp_Object, int, int);
86
87Lisp_Object Qdirectory_files; 82Lisp_Object Qdirectory_files;
88Lisp_Object Qdirectory_files_and_attributes; 83Lisp_Object Qdirectory_files_and_attributes;
89Lisp_Object Qfile_name_completion; 84Lisp_Object Qfile_name_completion;
@@ -102,7 +97,7 @@ directory_files_internal_w32_unwind (Lisp_Object arg)
102} 97}
103#endif 98#endif
104 99
105Lisp_Object 100static Lisp_Object
106directory_files_internal_unwind (Lisp_Object dh) 101directory_files_internal_unwind (Lisp_Object dh)
107{ 102{
108 DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer; 103 DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer;
@@ -233,11 +228,11 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m
233 int len; 228 int len;
234 int wanted = 0; 229 int wanted = 0;
235 Lisp_Object name, finalname; 230 Lisp_Object name, finalname;
236 struct gcpro gcpro1, gcpro2; 231 struct gcpro inner_gcpro1, inner_gcpro2;
237 232
238 len = NAMLEN (dp); 233 len = NAMLEN (dp);
239 name = finalname = make_unibyte_string (dp->d_name, len); 234 name = finalname = make_unibyte_string (dp->d_name, len);
240 GCPRO2 (finalname, name); 235 GCPRO2_VAR (finalname, name, inner_gcpro);
241 236
242 /* Note: DECODE_FILE can GC; it should protect its argument, 237 /* Note: DECODE_FILE can GC; it should protect its argument,
243 though. */ 238 though. */
@@ -293,23 +288,23 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m
293 /* Construct an expanded filename for the directory entry. 288 /* Construct an expanded filename for the directory entry.
294 Use the decoded names for input to Ffile_attributes. */ 289 Use the decoded names for input to Ffile_attributes. */
295 Lisp_Object decoded_fullname, fileattrs; 290 Lisp_Object decoded_fullname, fileattrs;
296 struct gcpro gcpro1, gcpro2; 291 struct gcpro innermost_gcpro1, innermost_gcpro2;
297 292
298 decoded_fullname = fileattrs = Qnil; 293 decoded_fullname = fileattrs = Qnil;
299 GCPRO2 (decoded_fullname, fileattrs); 294 GCPRO2_VAR (decoded_fullname, fileattrs, innermost_gcpro);
300 295
301 /* Both Fexpand_file_name and Ffile_attributes can GC. */ 296 /* Both Fexpand_file_name and Ffile_attributes can GC. */
302 decoded_fullname = Fexpand_file_name (name, directory); 297 decoded_fullname = Fexpand_file_name (name, directory);
303 fileattrs = Ffile_attributes (decoded_fullname, id_format); 298 fileattrs = Ffile_attributes (decoded_fullname, id_format);
304 299
305 list = Fcons (Fcons (finalname, fileattrs), list); 300 list = Fcons (Fcons (finalname, fileattrs), list);
306 UNGCPRO; 301 UNGCPRO_VAR (innermost_gcpro);
307 } 302 }
308 else 303 else
309 list = Fcons (finalname, list); 304 list = Fcons (finalname, list);
310 } 305 }
311 306
312 UNGCPRO; 307 UNGCPRO_VAR (inner_gcpro);
313 } 308 }
314 } 309 }
315 310
@@ -676,11 +671,11 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
676 if (!NILP (predicate)) 671 if (!NILP (predicate))
677 { 672 {
678 Lisp_Object val; 673 Lisp_Object val;
679 struct gcpro gcpro1; 674 struct gcpro inner_gcpro1;
680 675
681 GCPRO1 (name); 676 GCPRO1_VAR (name, inner_gcpro);
682 val = call1 (predicate, name); 677 val = call1 (predicate, name);
683 UNGCPRO; 678 UNGCPRO_VAR (inner_gcpro);
684 679
685 if (NILP (val)) 680 if (NILP (val))
686 continue; 681 continue;
@@ -702,16 +697,16 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
702 Lisp_Object zero = make_number (0); 697 Lisp_Object zero = make_number (0);
703 /* FIXME: This is a copy of the code in Ftry_completion. */ 698 /* FIXME: This is a copy of the code in Ftry_completion. */
704 int compare = min (bestmatchsize, SCHARS (name)); 699 int compare = min (bestmatchsize, SCHARS (name));
705 Lisp_Object tem 700 Lisp_Object cmp
706 = Fcompare_strings (bestmatch, zero, 701 = Fcompare_strings (bestmatch, zero,
707 make_number (compare), 702 make_number (compare),
708 name, zero, 703 name, zero,
709 make_number (compare), 704 make_number (compare),
710 completion_ignore_case ? Qt : Qnil); 705 completion_ignore_case ? Qt : Qnil);
711 int matchsize 706 int matchsize
712 = (EQ (tem, Qt) ? compare 707 = (EQ (cmp, Qt) ? compare
713 : XINT (tem) < 0 ? - XINT (tem) - 1 708 : XINT (cmp) < 0 ? - XINT (cmp) - 1
714 : XINT (tem) - 1); 709 : XINT (cmp) - 1);
715 710
716 if (completion_ignore_case) 711 if (completion_ignore_case)
717 { 712 {
@@ -735,18 +730,18 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
735 (((matchsize == SCHARS (name)) 730 (((matchsize == SCHARS (name))
736 == 731 ==
737 (matchsize + !!directoryp == SCHARS (bestmatch))) 732 (matchsize + !!directoryp == SCHARS (bestmatch)))
738 && (tem = Fcompare_strings (name, zero, 733 && (cmp = Fcompare_strings (name, zero,
739 make_number (SCHARS (file)), 734 make_number (SCHARS (file)),
740 file, zero, 735 file, zero,
741 Qnil, 736 Qnil,
742 Qnil), 737 Qnil),
743 EQ (Qt, tem)) 738 EQ (Qt, cmp))
744 && (tem = Fcompare_strings (bestmatch, zero, 739 && (cmp = Fcompare_strings (bestmatch, zero,
745 make_number (SCHARS (file)), 740 make_number (SCHARS (file)),
746 file, zero, 741 file, zero,
747 Qnil, 742 Qnil,
748 Qnil), 743 Qnil),
749 ! EQ (Qt, tem)))) 744 ! EQ (Qt, cmp))))
750 bestmatch = name; 745 bestmatch = name;
751 } 746 }
752 bestmatchsize = matchsize; 747 bestmatchsize = matchsize;
@@ -795,8 +790,8 @@ scmp (const char *s1, const char *s2, int len)
795 if (completion_ignore_case) 790 if (completion_ignore_case)
796 { 791 {
797 while (l 792 while (l
798 && (DOWNCASE ((unsigned char) *s1++) 793 && (downcase ((unsigned char) *s1++)
799 == DOWNCASE ((unsigned char) *s2++))) 794 == downcase ((unsigned char) *s2++)))
800 l--; 795 l--;
801 } 796 }
802 else 797 else
@@ -848,13 +843,6 @@ file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_ad
848 return value; 843 return value;
849} 844}
850 845
851Lisp_Object
852make_time (time_t time)
853{
854 return Fcons (make_number (time >> 16),
855 Fcons (make_number (time & 0177777), Qnil));
856}
857
858static char * 846static char *
859stat_uname (struct stat *st) 847stat_uname (struct stat *st)
860{ 848{