X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/1399490e2bb58e1e7212d7a8469e1286ced9423a..c72d972c5dee96489a3fd881b239f3f7d0db2385:/src/dired.c?ds=sidebyside diff --git a/src/dired.c b/src/dired.c index 7bbfee7e5b..d8da45bf77 100644 --- a/src/dired.c +++ b/src/dired.c @@ -1,5 +1,5 @@ /* Lisp functions for making directory listings. - Copyright (C) 1985-1986, 1993-1994, 1999-2013 Free Software + Copyright (C) 1985-1986, 1993-1994, 1999-2014 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -95,7 +95,7 @@ open_directory (char const *name, int *fdp) d = fdopendir (fd); opendir_errno = errno; if (! d) - close (fd); + emacs_close (fd); } #endif @@ -107,22 +107,20 @@ open_directory (char const *name, int *fdp) } #ifdef WINDOWSNT -Lisp_Object +void directory_files_internal_w32_unwind (Lisp_Object arg) { Vw32_get_true_file_attributes = arg; - return Qnil; } #endif -static Lisp_Object -directory_files_internal_unwind (Lisp_Object dh) +static void +directory_files_internal_unwind (void *dh) { - DIR *d = XSAVE_POINTER (dh, 0); + DIR *d = dh; block_input (); closedir (d); unblock_input (); - return Qnil; } /* Function shared by Fdirectory_files and Fdirectory_files_and_attributes. @@ -185,13 +183,12 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, d = open_directory (SSDATA (dirfilename), &fd); if (d == NULL) - report_file_error ("Opening directory", Fcons (directory, Qnil)); + report_file_error ("Opening directory", directory); /* Unfortunately, we can now invoke expand-file-name and file-attributes on filenames, both of which can throw, so we must do a proper unwind-protect. */ - record_unwind_protect (directory_files_internal_unwind, - make_save_pointer (d)); + record_unwind_protect_ptr (directory_files_internal_unwind, d); #ifdef WINDOWSNT if (attrs) @@ -281,7 +278,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, memcpy (SDATA (fullname) + directory_nbytes + needsep, SDATA (name), len); - nchars = chars_in_text (SDATA (fullname), nbytes); + nchars = multibyte_chars_in_text (SDATA (fullname), nbytes); /* Some bug somewhere. */ if (nchars > nbytes) @@ -488,10 +485,9 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, d = open_directory (SSDATA (encoded_dir), &fd); if (!d) - report_file_error ("Opening directory", Fcons (dirname, Qnil)); + report_file_error ("Opening directory", dirname); - record_unwind_protect (directory_files_internal_unwind, - make_save_pointer (d)); + record_unwind_protect_ptr (directory_files_internal_unwind, d); /* Loop reading blocks */ /* (att3b compiler bug requires do a null comparison this way) */ @@ -962,11 +958,11 @@ file_attributes (int fd, char const *name, Lisp_Object id_format) unblock_input (); } if (uname) - values[2] = DECODE_SYSTEM (build_string (uname)); + values[2] = DECODE_SYSTEM (build_unibyte_string (uname)); else values[2] = make_fixnum_or_float (s.st_uid); if (gname) - values[3] = DECODE_SYSTEM (build_string (gname)); + values[3] = DECODE_SYSTEM (build_unibyte_string (gname)); else values[3] = make_fixnum_or_float (s.st_gid); @@ -988,7 +984,7 @@ file_attributes (int fd, char const *name, Lisp_Object id_format) values[10] = INTEGER_TO_CONS (s.st_ino); values[11] = INTEGER_TO_CONS (s.st_dev); - return Flist (sizeof (values) / sizeof (values[0]), values); + return Flist (ARRAYELTS (values), values); } DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, Sfile_attributes_lessp, 2, 2, 0, @@ -1017,7 +1013,7 @@ return a list with one element, taken from `user-real-login-name'. */) #endif if (EQ (users, Qnil)) /* At least current user is always known. */ - users = Fcons (Vuser_real_login_name, Qnil); + users = list1 (Vuser_real_login_name); return users; }