emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113381: * inotify.c (uninitialized): Remove. All us


From: Paul Eggert
Subject: [Emacs-diffs] trunk r113381: * inotify.c (uninitialized): Remove. All uses replaced by -1.
Date: Thu, 11 Jul 2013 17:29:00 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113381
revision-id: address@hidden
parent: address@hidden
author: Paul Eggert  <address@hidden>
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Thu 2013-07-11 10:28:58 -0700
message:
  * inotify.c (uninitialized): Remove.  All uses replaced by -1.
  
  (Finotify_add_watch): Simplify, since -1 means uninitialized now.
  Touch up doc a bit.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/inotify.c                  inotify.c-20121210111500-2cd7np2oq1r0lmp9-1
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-07-11 07:17:23 +0000
+++ b/src/ChangeLog     2013-07-11 17:28:58 +0000
@@ -1,5 +1,9 @@
 2013-07-11  Paul Eggert  <address@hidden>
 
+       * inotify.c (uninitialized): Remove.  All uses replaced by -1.
+       (Finotify_add_watch): Simplify, since -1 means uninitialized now.
+       Touch up doc a bit.
+
        * eval.c (backtrace_function, backtrace_args): Now EXTERNALLY_VISIBLE.
        This is for .gdbinit xbacktrace.
 

=== modified file 'src/inotify.c'
--- a/src/inotify.c     2013-07-04 09:29:28 +0000
+++ b/src/inotify.c     2013-07-11 17:28:58 +0000
@@ -71,9 +71,8 @@
 # define IN_ONLYDIR 0
 #endif
 
-enum { uninitialized = -100 };
 /* File handle for inotify.  */
-static int inotifyfd = uninitialized;
+static int inotifyfd = -1;
 
 /* Assoc list of files being watched.
    Format:
@@ -268,8 +267,10 @@
 DEFUN ("inotify-add-watch", Finotify_add_watch, Sinotify_add_watch, 3, 3, 0,
        doc: /* Add a watch for FILE-NAME to inotify.
 
-A WATCH-DESCRIPTOR is returned on success.  ASPECT might be one of the 
following
-symbols or a list of those symbols:
+Return a watch descriptor.  The watch will look for ASPECT events and
+invoke CALLBACK when an event occurs.
+
+ASPECT might be one of the following symbols or a list of those symbols:
 
 access
 attrib
@@ -288,7 +289,7 @@
 move
 close
 
-The following symbols can also be added to a list of aspects
+The following symbols can also be added to a list of aspects:
 
 dont-follow
 excl-unlink
@@ -296,9 +297,8 @@
 oneshot
 onlydir
 
-Watching a directory is not recursive.  CALLBACK gets called in case of an
-event.  It gets passed a single argument EVENT which contains an event 
structure
-of the format
+Watching a directory is not recursive.  CALLBACK is passed a single argument
+EVENT which contains an event structure of the format
 
 (WATCH-DESCRIPTOR ASPECTS NAME COOKIE)
 
@@ -331,16 +331,13 @@
 
   CHECK_STRING (file_name);
 
-  if (inotifyfd == uninitialized)
+  if (inotifyfd < 0)
     {
       inotifyfd = inotify_init1 (IN_NONBLOCK|IN_CLOEXEC);
-      if (inotifyfd == -1)
-        {
-          inotifyfd = uninitialized;
-         xsignal1
-           (Qfile_notify_error,
-            build_string ("File watching feature (inotify) is not available"));
-        }
+      if (inotifyfd < 0)
+       xsignal1
+         (Qfile_notify_error,
+          build_string ("File watching feature (inotify) is not available"));
       watch_list = Qnil;
       add_read_fd (inotifyfd, &inotify_callback, NULL);
     }
@@ -392,7 +389,7 @@
     {
       close (inotifyfd);
       delete_read_fd (inotifyfd);
-      inotifyfd = uninitialized;
+      inotifyfd = -1;
     }
 
   return Qt;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]