* dired.c (Ffile_attributes): Simplify and avoid #ifdef.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 22 Feb 2011 18:32:51 +0000 (10:32 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 22 Feb 2011 18:32:51 +0000 (10:32 -0800)
src/ChangeLog
src/dired.c

index 097742c..8befb78 100644 (file)
@@ -1,3 +1,7 @@
+2011-02-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * dired.c (Ffile_attributes): Simplify and avoid #ifdef.
+
 2011-02-22  Wolfgang Jenkner  <wjenkner@inode.at>  (tiny change)
 
        * lread.c (openp): Correct Boolean typo in last commit.
index 92c1284..eea4c7c 100644 (file)
@@ -963,17 +963,8 @@ so last access time will always be midnight of that day.  */)
   if (lstat (SSDATA (encoded), &s) < 0)
     return Qnil;
 
-  switch (s.st_mode & S_IFMT)
-    {
-    default:
-      values[0] = Qnil; break;
-    case S_IFDIR:
-      values[0] = Qt; break;
-#ifdef S_IFLNK
-    case S_IFLNK:
-      values[0] = Ffile_symlink_p (filename); break;
-#endif
-    }
+  values[0] = (S_ISLNK (s.st_mode) ? Ffile_symlink_p (filename)
+              : S_ISDIR (s.st_mode) ? Qt : Qnil);
   values[1] = make_number (s.st_nlink);
 
   if (!(NILP (id_format) || EQ (id_format, Qinteger)))