summaryrefslogtreecommitdiff
path: root/src/lread.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-04-01 18:54:56 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2013-04-01 18:54:56 -0700
commit7216e43b329303146455bb1dace88f8c61b1cd20 (patch)
tree900c267701eccb66398b6514816e153fb50b6a26 /src/lread.c
parent4b725a70efa7ed781b6d5e466c8acc246f68f49d (diff)
downloademacs-7216e43b329303146455bb1dace88f8c61b1cd20.tar.gz
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.
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lread.c b/src/lread.c
index d7a16f813c8..8e623e838c7 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2636,7 +2636,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
nskip--;
else
UNREAD (c);
-
+
if (load_force_doc_strings
&& (FROM_FILE_P (readcharfun)))
{
@@ -2731,8 +2731,8 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
/* 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 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
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 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
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 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
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;