all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#22996: [PATCH] Use directory_files_internal_unwind() in directory_files_internal ()
@ 2016-03-12 13:49 Alexander Kuleshov
  2016-03-20  1:47 ` Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kuleshov @ 2016-03-12 13:49 UTC (permalink / raw)
  To: 22996; +Cc: Alexander Kuleshov

src/dired.c (directory_files_internal): use directory_files_internal_unwind()
to prevent code duplication.
---
 src/dired.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/dired.c b/src/dired.c
index ebc7029..b5b6af6 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -307,9 +307,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
 	}
     }
 
-  block_input ();
-  closedir (d);
-  unblock_input ();
+  directory_files_internal_unwind ((void*) d);
 #ifdef WINDOWSNT
   if (attrs)
     Vw32_get_true_file_attributes = w32_save;
-- 
2.8.0.rc0.61.g9f22707






^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#22996: [PATCH] Use directory_files_internal_unwind() in directory_files_internal ()
  2016-03-12 13:49 bug#22996: [PATCH] Use directory_files_internal_unwind() in directory_files_internal () Alexander Kuleshov
@ 2016-03-20  1:47 ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2016-03-20  1:47 UTC (permalink / raw)
  To: Alexander Kuleshov; +Cc: 22996-done

[-- Attachment #1: Type: text/plain, Size: 114 bytes --]

Thanks for pointing out the code infelicity. I installed the attached, which 
cleans it up in a more-general way.

[-- Attachment #2: 0001-No-need-to-block-input-when-reading-directories.txt --]
[-- Type: text/plain, Size: 2349 bytes --]

From 1077dac30146fcc9a02e3df9ea3ab7da02dc0d87 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 19 Mar 2016 18:44:15 -0700
Subject: [PATCH] No need to block input when reading directories
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* src/dired.c: Don’t include blockinput.h.
(open_directory, directory_files_internal_unwind)
(directory_files_internal, file_attributes):
Don’t block input here, as the reasons for blocking input should
no longer apply.  See blockinput.h FIXME.  (Bug#22996).
---
 src/dired.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/src/dired.c b/src/dired.c
index ebc7029..5d0e327 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -42,7 +42,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "buffer.h"
 #include "coding.h"
 #include "regex.h"
-#include "blockinput.h"
 
 #ifdef MSDOS
 #include "msdos.h"	/* for fstatat */
@@ -69,8 +68,6 @@ open_directory (Lisp_Object dirname, int *fdp)
   DIR *d;
   int fd, opendir_errno;
 
-  block_input ();
-
 #ifdef DOS_NT
   /* Directories cannot be opened.  The emulation assumes that any
      file descriptor other than AT_FDCWD corresponds to the most
@@ -94,8 +91,6 @@ open_directory (Lisp_Object dirname, int *fdp)
     }
 #endif
 
-  unblock_input ();
-
   if (!d)
     report_file_errno ("Opening directory", dirname, opendir_errno);
   *fdp = fd;
@@ -111,12 +106,9 @@ directory_files_internal_w32_unwind (Lisp_Object arg)
 #endif
 
 static void
-directory_files_internal_unwind (void *dh)
+directory_files_internal_unwind (void *d)
 {
-  DIR *d = dh;
-  block_input ();
   closedir (d);
-  unblock_input ();
 }
 
 /* Return the next directory entry from DIR; DIR's name is DIRNAME.
@@ -307,9 +299,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
 	}
     }
 
-  block_input ();
   closedir (d);
-  unblock_input ();
 #ifdef WINDOWSNT
   if (attrs)
     Vw32_get_true_file_attributes = w32_save;
@@ -959,10 +949,8 @@ file_attributes (int fd, char const *name, Lisp_Object id_format)
 
   if (!(NILP (id_format) || EQ (id_format, Qinteger)))
     {
-      block_input ();
       uname = stat_uname (&s);
       gname = stat_gname (&s);
-      unblock_input ();
     }
 
   filemodestring (&s, modes);
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-20  1:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-12 13:49 bug#22996: [PATCH] Use directory_files_internal_unwind() in directory_files_internal () Alexander Kuleshov
2016-03-20  1:47 ` Paul Eggert

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.