]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove some tautological comparisons involving rlim_t
authorPhilipp Stephani <phst@google.com>
Wed, 14 Jun 2017 10:35:58 +0000 (12:35 +0200)
committerPhilipp Stephani <phst@google.com>
Wed, 14 Jun 2017 10:35:58 +0000 (12:35 +0200)
Clang on macOS warns about these with -Wtautological-compare.  POSIX
guarantees that rlim_t is
unsigned (cf.
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/resource.h.html),
so these resource limits can never be negative.

* src/emacs.c (main): Remove tautological comparisons.

src/emacs.c

index da8df1bf1c7b00d505e76dd07e2cc05c87b76b78..08430de6ca78cc1943de241855bee6f8a680a43c 100644 (file)
@@ -832,7 +832,7 @@ main (int argc, char **argv)
      (https://www.cygwin.com/ml/cygwin/2015-07/msg00096.html).  */
   struct rlimit rlim;
   if (getrlimit (RLIMIT_STACK, &rlim) == 0
-      && 0 <= rlim.rlim_cur && rlim.rlim_cur <= LONG_MAX)
+      && rlim.rlim_cur <= LONG_MAX)
     {
       rlim_t lim = rlim.rlim_cur;
 
@@ -866,7 +866,7 @@ main (int argc, char **argv)
             right thing anyway.  */
          long pagesize = getpagesize ();
          newlim += pagesize - 1;
-         if (0 <= rlim.rlim_max && rlim.rlim_max < newlim)
+         if (rlim.rlim_max < newlim)
            newlim = rlim.rlim_max;
          newlim -= newlim % pagesize;