emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112211: Prefer < to > in range check


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112211: Prefer < to > in range checks such as 0 <= i && i < N.
Date: Mon, 01 Apr 2013 18:54:56 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112211
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Mon 2013-04-01 18:54:56 -0700
message:
  Prefer < to > in range checks such as 0 <= i && i < N.
  
  This makes it easier to visualize quantities on a number line.
  This patch doesn't apply to all such range checks,
  only to the range checks affected by the 2013-03-24 change.
  This patch reverts most of the 2013-03-24 change.
  * alloc.c (xpalloc, Fgarbage_collect):
  * ccl.c (ccl_driver, resolve_symbol_ccl_program):
  * character.c (string_escape_byte8):
  * charset.c (read_hex):
  * data.c (cons_to_unsigned):
  * dispnew.c (update_frame_1):
  * doc.c (Fsubstitute_command_keys):
  * doprnt.c (doprnt):
  * editfns.c (hi_time, decode_time_components):
  * fileio.c (file_offset):
  * fns.c (larger_vector, make_hash_table, Fmake_hash_table):
  * font.c (font_intern_prop):
  * frame.c (x_set_alpha):
  * gtkutil.c (get_utf8_string):
  * indent.c (check_display_width):
  * keymap.c (Fkey_description):
  * lisp.h (FIXNUM_OVERFLOW_P, vcopy):
  * lread.c (read1):
  * minibuf.c (read_minibuf_noninteractive):
  * process.c (wait_reading_process_output):
  * search.c (Freplace_match):
  * window.c (get_phys_cursor_glyph):
  * xdisp.c (redisplay_internal):
  * xsmfns.c (smc_save_yourself_CB):
  Prefer < to > for range checks.
  * dispnew.c (sit_for): Don't mishandle NaNs.
  This fixes a bug introduced in the 2013-03-24 change.
  * editfns.c (decode_time_components): Don't hoist comparison.
  This fixes another bug introduced in the 2013-03-24 change.
modified:
  src/ChangeLog
  src/alloc.c
  src/ccl.c
  src/character.c
  src/charset.c
  src/data.c
  src/dired.c
  src/dispnew.c
  src/doc.c
  src/doprnt.c
  src/editfns.c
  src/fileio.c
  src/fns.c
  src/font.c
  src/frame.c
  src/gtkutil.c
  src/indent.c
  src/keymap.c
  src/lisp.h
  src/lread.c
  src/minibuf.c
  src/process.c
  src/search.c
  src/window.c
  src/xdisp.c
  src/xsmfns.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-03-31 05:45:54 +0000
+++ b/src/ChangeLog     2013-04-02 01:54:56 +0000
@@ -1,3 +1,40 @@
+2013-04-02  Paul Eggert  <address@hidden>
+
+       Prefer < to > in range checks such as 0 <= i && i < N.
+       This makes it easier to visualize quantities on a number line.
+       This patch doesn't apply to all such range checks,
+       only to the range checks affected by the 2013-03-24 change.
+       This patch reverts most of the 2013-03-24 change.
+       * alloc.c (xpalloc, Fgarbage_collect):
+       * ccl.c (ccl_driver, resolve_symbol_ccl_program):
+       * character.c (string_escape_byte8):
+       * charset.c (read_hex):
+       * data.c (cons_to_unsigned):
+       * dispnew.c (update_frame_1):
+       * doc.c (Fsubstitute_command_keys):
+       * doprnt.c (doprnt):
+       * editfns.c (hi_time, decode_time_components):
+       * fileio.c (file_offset):
+       * fns.c (larger_vector, make_hash_table, Fmake_hash_table):
+       * font.c (font_intern_prop):
+       * frame.c (x_set_alpha):
+       * gtkutil.c (get_utf8_string):
+       * indent.c (check_display_width):
+       * keymap.c (Fkey_description):
+       * lisp.h (FIXNUM_OVERFLOW_P, vcopy):
+       * lread.c (read1):
+       * minibuf.c (read_minibuf_noninteractive):
+       * process.c (wait_reading_process_output):
+       * search.c (Freplace_match):
+       * window.c (get_phys_cursor_glyph):
+       * xdisp.c (redisplay_internal):
+       * xsmfns.c (smc_save_yourself_CB):
+       Prefer < to > for range checks.
+       * dispnew.c (sit_for): Don't mishandle NaNs.
+       This fixes a bug introduced in the 2013-03-24 change.
+       * editfns.c (decode_time_components): Don't hoist comparison.
+       This fixes another bug introduced in the 2013-03-24 change.
+
 2013-03-31  Dmitry Antipov  <address@hidden>
 
        * frame.h (struct frame): Drop scroll_bottom_vpos

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2013-03-28 14:04:49 +0000
+++ b/src/alloc.c       2013-04-02 01:54:56 +0000
@@ -779,7 +779,7 @@
   ptrdiff_t nitems_incr_max = n_max - n;
   ptrdiff_t incr = max (nitems_incr_min, min (incr_estimate, nitems_incr_max));
 
-  eassert (item_size > 0 && nitems_incr_min > 0 && n >= 0 && nitems_max >= -1);
+  eassert (0 < item_size && 0 < nitems_incr_min && 0 <= n && -1 <= nitems_max);
   if (! pa)
     *nitems = 0;
   if (nitems_incr_max < incr)
@@ -5376,7 +5376,7 @@
       double tot = total_bytes_of_live_objects ();
 
       tot *= XFLOAT_DATA (Vgc_cons_percentage);
-      if (tot > 0)
+      if (0 < tot)
        {
          if (tot < TYPE_MAXIMUM (EMACS_INT))
            gc_relative_threshold = tot;

=== modified file 'src/ccl.c'
--- a/src/ccl.c 2013-03-24 12:59:45 +0000
+++ b/src/ccl.c 2013-04-02 01:54:56 +0000
@@ -1668,7 +1668,7 @@
                  }
                map = XCDR (map);
                if (! (VECTORP (map)
-                      && ASIZE (map) > 0
+                      && 0 < ASIZE (map)
                       && INTEGERP (AREF (map, 0))
                       && XINT (AREF (map, 0)) <= op
                       && op - XINT (AREF (map, 0)) + 1 < ASIZE (map)))
@@ -1867,7 +1867,7 @@
       return Qnil;
     }
 
-  if (! (XINT (AREF (result, CCL_HEADER_BUF_MAG)) >= 0
+  if (! (0 <= XINT (AREF (result, CCL_HEADER_BUF_MAG))
         && ASCENDING_ORDER (0, XINT (AREF (result, CCL_HEADER_EOF)),
                             ASIZE (ccl))))
     return Qnil;

=== modified file 'src/character.c'
--- a/src/character.c   2013-03-24 12:59:45 +0000
+++ b/src/character.c   2013-04-02 01:54:56 +0000
@@ -833,8 +833,8 @@
 
   if (multibyte)
     {
-      if (byte8_count > (MOST_POSITIVE_FIXNUM - nchars) / 3
-         || byte8_count > (STRING_BYTES_BOUND - nbytes) / 2)
+      if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count
+         || (STRING_BYTES_BOUND - nbytes) / 2 < byte8_count)
        string_overflow ();
 
       /* Convert 2-byte sequence of byte8 chars to 4-byte octal.  */
@@ -843,7 +843,7 @@
     }
   else
     {
-      if (byte8_count > (STRING_BYTES_BOUND - nbytes) / 3)
+      if ((STRING_BYTES_BOUND - nbytes) / 3 < byte8_count)
        string_overflow ();
 
       /* Convert 1-byte sequence of byte8 chars to 4-byte octal.  */

=== modified file 'src/charset.c'
--- a/src/charset.c     2013-03-24 12:59:45 +0000
+++ b/src/charset.c     2013-04-02 01:54:56 +0000
@@ -447,7 +447,7 @@
   n = 0;
   while (c_isxdigit (c = getc (fp)))
     {
-      if (n > UINT_MAX >> 4)
+      if (UINT_MAX >> 4 < n)
        *overflow = 1;
       n = ((n << 4)
           | (c - ('0' <= c && c <= '9' ? '0'

=== modified file 'src/data.c'
--- a/src/data.c        2013-03-24 12:59:45 +0000
+++ b/src/data.c        2013-04-02 01:54:56 +0000
@@ -2337,13 +2337,13 @@
   uintmax_t val IF_LINT (= 0);
   if (INTEGERP (c))
     {
-      valid = XINT (c) >= 0;
+      valid = 0 <= XINT (c);
       val = XINT (c);
     }
   else if (FLOATP (c))
     {
       double d = XFLOAT_DATA (c);
-      if (d >= 0
+      if (0 <= d
          && d < (max == UINTMAX_MAX ? (double) UINTMAX_MAX + 1 : max + 1))
        {
          val = d;

=== modified file 'src/dired.c'
--- a/src/dired.c       2013-03-24 12:59:45 +0000
+++ b/src/dired.c       2013-04-02 01:54:56 +0000
@@ -517,8 +517,9 @@
 
       QUIT;
       if (len < SCHARS (encoded_file)
-         || scmp (dp->d_name, SSDATA (encoded_file),
-                  SCHARS (encoded_file)) >= 0)
+         || (scmp (dp->d_name, SSDATA (encoded_file),
+                   SCHARS (encoded_file))
+             >= 0))
        continue;
 
       if (file_name_completion_stat (fd, dp, &st) < 0)

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2013-03-28 14:04:49 +0000
+++ b/src/dispnew.c     2013-04-02 01:54:56 +0000
@@ -4506,7 +4506,7 @@
        }
     }
 
-  lint_assume (FRAME_LINES (f) >= 0);
+  lint_assume (0 <= FRAME_LINES (f));
   pause_p = 0 < i && i < FRAME_LINES (f) - 1;
 
   /* Now just clean up termcap drivers and set cursor, etc.  */
@@ -5772,7 +5772,7 @@
   else if (FLOATP (timeout))
     {
       double seconds = XFLOAT_DATA (timeout);
-      if (seconds <= 0)
+      if (! (0 < seconds))
        return Qt;
       else
        {

=== modified file 'src/doc.c'
--- a/src/doc.c 2013-03-24 12:59:45 +0000
+++ b/src/doc.c 2013-04-02 01:54:56 +0000
@@ -826,7 +826,7 @@
          if (NILP (tem))       /* but not on any keys */
            {
              ptrdiff_t offset = bufp - buf;
-             if (bsize > STRING_BYTES_BOUND - 4)
+             if (STRING_BYTES_BOUND - 4 < bsize)
                string_overflow ();
              buf = xrealloc (buf, bsize += 4);
              bufp = buf + offset;

=== modified file 'src/doprnt.c'
--- a/src/doprnt.c      2013-03-24 12:59:45 +0000
+++ b/src/doprnt.c      2013-04-02 01:54:56 +0000
@@ -361,7 +361,7 @@
 
              /* Copy string into final output, truncating if no room.  */
            doit:
-             eassert (tem >= 0);
+             eassert (0 <= tem);
              /* Coming here means STRING contains ASCII only.  */
              if (STRING_BYTES_BOUND < tem)
                error ("Format width or precision too large");

=== modified file 'src/editfns.c'
--- a/src/editfns.c     2013-03-28 14:04:49 +0000
+++ b/src/editfns.c     2013-04-02 01:54:56 +0000
@@ -1398,8 +1398,8 @@
      no runtime check is needed, and taking care not to convert
      negative numbers to unsigned before comparing them.  */
   if (! ((! TYPE_SIGNED (time_t)
-         || TIME_T_MIN >> 16 >= MOST_NEGATIVE_FIXNUM
-         || hi >= MOST_NEGATIVE_FIXNUM)
+         || MOST_NEGATIVE_FIXNUM <= TIME_T_MIN >> 16
+         || MOST_NEGATIVE_FIXNUM <= hi)
         && (TIME_T_MAX >> 16 <= MOST_POSITIVE_FIXNUM
             || hi <= MOST_POSITIVE_FIXNUM)))
     time_overflow ();
@@ -1561,7 +1561,7 @@
 
   if (result)
     {
-      if (hi >= (TYPE_SIGNED (time_t) ? TIME_T_MIN >> 16 : 0)
+      if ((TYPE_SIGNED (time_t) ? TIME_T_MIN >> 16 <= hi : 0 <= hi)
          && hi <= TIME_T_MAX >> 16)
        {
          /* Return the greatest representable time that is not greater

=== modified file 'src/fileio.c'
--- a/src/fileio.c      2013-03-28 14:04:49 +0000
+++ b/src/fileio.c      2013-04-02 01:54:56 +0000
@@ -3449,7 +3449,7 @@
   if (FLOATP (val))
     {
       double v = XFLOAT_DATA (val);
-      if (v >= 0
+      if (0 <= v
          && (sizeof (off_t) < sizeof v
              ? v <= TYPE_MAXIMUM (off_t)
              : v < TYPE_MAXIMUM (off_t)))

=== modified file 'src/fns.c'
--- a/src/fns.c 2013-03-24 12:59:45 +0000
+++ b/src/fns.c 2013-04-02 01:54:56 +0000
@@ -3409,7 +3409,7 @@
   ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max
                     ? nitems_max : C_language_max);
   eassert (VECTORP (vec));
-  eassert (incr_min > 0 && nitems_max >= -1);
+  eassert (0 < incr_min && -1 <= nitems_max);
   old_size = ASIZE (vec);
   incr_max = n_max - old_size;
   incr = max (incr_min, min (old_size >> 1, incr_max));
@@ -3574,9 +3574,9 @@
   eassert (SYMBOLP (test.name));
   eassert (INTEGERP (size) && XINT (size) >= 0);
   eassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0)
-          || (FLOATP (rehash_size) && XFLOAT_DATA (rehash_size) > 1));
+          || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size)));
   eassert (FLOATP (rehash_threshold)
-          && XFLOAT_DATA (rehash_threshold) > 0
+          && 0 < XFLOAT_DATA (rehash_threshold)
           && XFLOAT_DATA (rehash_threshold) <= 1.0);
 
   if (XFASTINT (size) == 0)
@@ -4312,15 +4312,15 @@
   /* Look for `:rehash-size SIZE'.  */
   i = get_key_arg (QCrehash_size, nargs, args, used);
   rehash_size = i ? args[i] : make_float (DEFAULT_REHASH_SIZE);
-  if (! ((INTEGERP (rehash_size) && XINT (rehash_size) > 0)
-        || (FLOATP (rehash_size) && XFLOAT_DATA (rehash_size) > 1)))
+  if (! ((INTEGERP (rehash_size) && 0 < XINT (rehash_size))
+        || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size))))
     signal_error ("Invalid hash table rehash size", rehash_size);
 
   /* Look for `:rehash-threshold THRESHOLD'.  */
   i = get_key_arg (QCrehash_threshold, nargs, args, used);
   rehash_threshold = i ? args[i] : make_float (DEFAULT_REHASH_THRESHOLD);
   if (! (FLOATP (rehash_threshold)
-        && XFLOAT_DATA (rehash_threshold) > 0
+        && 0 < XFLOAT_DATA (rehash_threshold)
         && XFLOAT_DATA (rehash_threshold) <= 1))
     signal_error ("Invalid hash table rehash threshold", rehash_threshold);
 

=== modified file 'src/font.c'
--- a/src/font.c        2013-03-28 14:04:49 +0000
+++ b/src/font.c        2013-04-02 01:54:56 +0000
@@ -229,7 +229,7 @@
 
   if (len == 1 && *str == '*')
     return Qnil;
-  if (!force_symbol && len > 0 && '0' <= *str && *str <= '9')
+  if (!force_symbol && 0 < len && '0' <= *str && *str <= '9')
     {
       for (i = 1; i < len; i++)
        if (! ('0' <= str[i] && str[i] <= '9'))
@@ -243,7 +243,7 @@
            {
              if (i == len)
                return make_number (n);
-             if (n > MOST_POSITIVE_FIXNUM / 10)
+             if (MOST_POSITIVE_FIXNUM / 10 < n)
                break;
            }
 

=== modified file 'src/frame.c'
--- a/src/frame.c       2013-03-28 14:04:49 +0000
+++ b/src/frame.c       2013-04-02 01:54:56 +0000
@@ -889,7 +889,7 @@
 /* Return CANDIDATE if it can be used as 'other-than-FRAME' frame on the
    same tty (for tty frames) or among frames which uses FRAME's keyboard.
    If MINIBUF is nil, do not consider minibuffer-only candidate.
-   If MINIBUF is `visible', do not consider an invisible candidate. 
+   If MINIBUF is `visible', do not consider an invisible candidate.
    If MINIBUF is a window, consider only its own frame and candidate now
    using that window as the minibuffer.
    If MINIBUF is 0, consider candidate if it is visible or iconified.
@@ -3311,16 +3311,15 @@
       else if (FLOATP (item))
        {
          alpha = XFLOAT_DATA (item);
-         if (alpha < 0.0 || alpha > 1.0)
+         if (! (0 <= alpha && alpha <= 1.0))
            args_out_of_range (make_float (0.0), make_float (1.0));
        }
       else if (INTEGERP (item))
        {
          EMACS_INT ialpha = XINT (item);
-         if (ialpha < 0 || ialpha > 100)
+         if (! (0 <= ialpha && alpha <= 100))
            args_out_of_range (make_number (0), make_number (100));
-         else
-           alpha = ialpha / 100.0;
+         alpha = ialpha / 100.0;
        }
       else
        wrong_type_argument (Qnumberp, item);

=== modified file 'src/gtkutil.c'
--- a/src/gtkutil.c     2013-03-26 15:34:45 +0000
+++ b/src/gtkutil.c     2013-04-02 01:54:56 +0000
@@ -543,7 +543,7 @@
       if (cp) g_free (cp);
 
       len = strlen (str);
-      if (nr_bad > (min (PTRDIFF_MAX, SIZE_MAX) - len - 1) / 4)
+      if ((min (PTRDIFF_MAX, SIZE_MAX) - len - 1) / 4 < nr_bad)
        memory_full (SIZE_MAX);
       up = utf8_str = xmalloc (len + nr_bad * 4 + 1);
       p = (unsigned char *)str;

=== modified file 'src/indent.c'
--- a/src/indent.c      2013-03-29 15:50:21 +0000
+++ b/src/indent.c      2013-04-02 01:54:56 +0000
@@ -466,7 +466,7 @@
       if ((prop = Fplist_get (plist, QCwidth),
           RANGED_INTEGERP (0, prop, INT_MAX)))
        width = XINT (prop);
-      else if (FLOATP (prop) && XFLOAT_DATA (prop) >= 0
+      else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop)
               && XFLOAT_DATA (prop) <= INT_MAX)
        width = (int)(XFLOAT_DATA (prop) + 0.5);
       else if ((prop = Fplist_get (plist, QCalign_to),

=== modified file 'src/keymap.c'
--- a/src/keymap.c      2013-03-28 14:04:49 +0000
+++ b/src/keymap.c      2013-04-02 01:54:56 +0000
@@ -2063,7 +2063,7 @@
     size += XINT (Flength (prefix));
 
   /* This has one extra element at the end that we don't pass to Fconcat.  */
-  if (size > min (PTRDIFF_MAX, SIZE_MAX) / word_size / 4)
+  if (min (PTRDIFF_MAX, SIZE_MAX) / word_size / 4 < size)
     memory_full (SIZE_MAX);
   SAFE_ALLOCA_LISP (args, size * 4);
 

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2013-03-28 16:21:38 +0000
+++ b/src/lisp.h        2013-04-02 01:54:56 +0000
@@ -543,7 +543,7 @@
    type or if I is a NaN.  */
 
 #define FIXNUM_OVERFLOW_P(i) \
-  (! (((i) >= 0 || (i) >= MOST_NEGATIVE_FIXNUM) && (i) <= 
MOST_POSITIVE_FIXNUM))
+  (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <= 
MOST_POSITIVE_FIXNUM))
 
 LISP_INLINE ptrdiff_t
 clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
@@ -2560,7 +2560,7 @@
 LISP_INLINE void
 vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count)
 {
-  eassert (offset >= 0 && count >= 0 && offset + count <= ASIZE (v));
+  eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v));
   memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args);
 }
 

=== modified file 'src/lread.c'
--- a/src/lread.c       2013-03-24 12:59:45 +0000
+++ b/src/lread.c       2013-04-02 01:54:56 +0000
@@ -2636,7 +2636,7 @@
            nskip--;
          else
            UNREAD (c);
-           
+
          if (load_force_doc_strings
              && (FROM_FILE_P (readcharfun)))
            {
@@ -2731,8 +2731,8 @@
          /* Read a non-negative integer.  */
          while (c >= '0' && c <= '9')
            {
-             if (n > MOST_POSITIVE_FIXNUM / 10
-                 || n * 10 + c - '0' > MOST_POSITIVE_FIXNUM)
+             if (MOST_POSITIVE_FIXNUM / 10 < n
+                 || MOST_POSITIVE_FIXNUM < n * 10 + c - '0')
                n = MOST_POSITIVE_FIXNUM + 1;
              else
                n = n * 10 + c - '0';
@@ -2930,7 +2930,7 @@
            if (end - p < MAX_MULTIBYTE_LENGTH)
              {
                ptrdiff_t offset = p - read_buffer;
-               if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2)
+               if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
                  memory_full (SIZE_MAX);
                read_buffer = xrealloc (read_buffer, read_buffer_size * 2);
                read_buffer_size *= 2;
@@ -3064,7 +3064,7 @@
              if (end - p < MAX_MULTIBYTE_LENGTH)
                {
                  ptrdiff_t offset = p - read_buffer;
-                 if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2)
+                 if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
                    memory_full (SIZE_MAX);
                  read_buffer = xrealloc (read_buffer, read_buffer_size * 2);
                  read_buffer_size *= 2;
@@ -3094,7 +3094,7 @@
          if (p == end)
            {
              ptrdiff_t offset = p - read_buffer;
-             if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2)
+             if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
                memory_full (SIZE_MAX);
              read_buffer = xrealloc (read_buffer, read_buffer_size * 2);
              read_buffer_size *= 2;

=== modified file 'src/minibuf.c'
--- a/src/minibuf.c     2013-03-28 14:04:49 +0000
+++ b/src/minibuf.c     2013-04-02 01:54:56 +0000
@@ -251,7 +251,7 @@
        {
          if (len == size)
            {
-             if (size > STRING_BYTES_BOUND / 2)
+             if (STRING_BYTES_BOUND / 2 < size)
                memory_full (SIZE_MAX);
              size *= 2;
              line = xrealloc (line, size);

=== modified file 'src/process.c'
--- a/src/process.c     2013-03-24 12:59:45 +0000
+++ b/src/process.c     2013-04-02 01:54:56 +0000
@@ -4236,7 +4236,7 @@
       time_limit = 0;
       nsecs = -1;
     }
-  else if (time_limit > TYPE_MAXIMUM (time_t))
+  else if (TYPE_MAXIMUM (time_t) < time_limit)
     time_limit = TYPE_MAXIMUM (time_t);
 
   /* Since we may need to wait several times,

=== modified file 'src/search.c'
--- a/src/search.c      2013-03-24 12:59:45 +0000
+++ b/src/search.c      2013-04-02 01:54:56 +0000
@@ -2533,9 +2533,9 @@
       bool str_multibyte = STRING_MULTIBYTE (newtext);
       bool really_changed = 0;
 
-      substed_alloc_size = (length > (STRING_BYTES_BOUND - 100) / 2
-                           ? STRING_BYTES_BOUND
-                           : length * 2 + 100);
+      substed_alloc_size = (length <= (STRING_BYTES_BOUND - 100) / 2
+                           ? length * 2 + 100
+                           : STRING_BYTES_BOUND);
       substed = xmalloc (substed_alloc_size);
       substed_len = 0;
 

=== modified file 'src/window.c'
--- a/src/window.c      2013-03-28 14:04:49 +0000
+++ b/src/window.c      2013-04-02 01:54:56 +0000
@@ -5944,7 +5944,7 @@
        hpos = row->used[TEXT_AREA] - 1;
     }
 
-  if (hpos >= 0 && hpos < row->used[TEXT_AREA])
+  if (0 <= hpos && hpos < row->used[TEXT_AREA])
     glyph = row->glyphs[TEXT_AREA] + hpos;
   else
     glyph = NULL;

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-03-31 05:45:54 +0000
+++ b/src/xdisp.c       2013-04-02 01:54:56 +0000
@@ -13168,7 +13168,7 @@
               PT == w->last_point
               /* Make sure the cursor was last displayed
                  in this window.  Otherwise we have to reposition it.  */
-              && w->cursor.vpos >= 0
+              && 0 <= w->cursor.vpos
               && w->cursor.vpos < WINDOW_TOTAL_LINES (w))
        {
          if (!must_finish)

=== modified file 'src/xsmfns.c'
--- a/src/xsmfns.c      2013-03-24 12:59:45 +0000
+++ b/src/xsmfns.c      2013-04-02 01:54:56 +0000
@@ -221,7 +221,7 @@
   props[props_idx]->name = xstrdup (SmRestartCommand);
   props[props_idx]->type = xstrdup (SmLISTofARRAY8);
   /* /path/to/emacs, --smid=xxx --no-splash --chdir=dir ... */
-  if (initial_argc > INT_MAX - 3)
+  if (INT_MAX - 3 < initial_argc)
     memory_full (SIZE_MAX);
   i = 3 + initial_argc;
   props[props_idx]->num_vals = i;


reply via email to

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