diff options
| author | Andreas Schwab | 2013-03-24 13:59:45 +0100 |
|---|---|---|
| committer | Andreas Schwab | 2013-03-24 13:59:45 +0100 |
| commit | 908589fd28437a9b0995b103e22ce5e4d421eb8a (patch) | |
| tree | ce3a4207b04f84fdc97ee1ca2dfbc369fcf07c2a /src | |
| parent | 7b0e2f853fcd88c58715fd159923d50dfdeb9cba (diff) | |
| download | emacs-908589fd28437a9b0995b103e22ce5e4d421eb8a.tar.gz emacs-908589fd28437a9b0995b103e22ce5e4d421eb8a.zip | |
Reorder conditions that are written backwards
* alloc.c (xpalloc, Fgarbage_collect): Reorder conditions that are
written backwards.
* blockinput.h (input_blocked_p): Likewise.
* bytecode.c (exec_byte_code): Likewise.
* callproc.c (call_process_kill, call_process_cleanup)
(Fcall_process): Likewise.
* ccl.c (ccl_driver, resolve_symbol_ccl_program)
(Fccl_execute_on_string): Likewise.
* character.c (string_escape_byte8): Likewise.
* charset.c (read_hex): Likewise.
* cm.c (calccost): Likewise.
* data.c (cons_to_unsigned): Likewise.
* dired.c (directory_files_internal, file_name_completion):
Likewise.
* dispnew.c (scrolling_window, update_frame_1, Fsleep_for)
(sit_for): Likewise.
* doc.c (Fsubstitute_command_keys): Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (hi_time, decode_time_components, Fformat): Likewise.
* emacsgtkfixed.c: Likewise.
* fileio.c (file_offset, Fwrite_region): Likewise.
* floatfns.c (Fexpt, fmod_float): Likewise.
* fns.c (larger_vector, make_hash_table, Fmake_hash_table):
Likewise.
* font.c (font_intern_prop): Likewise.
* frame.c (x_set_alpha): Likewise.
* gtkutil.c (get_utf8_string): Likewise.
* indent.c (check_display_width): Likewise.
* intervals.c (create_root_interval, rotate_right, rotate_left)
(split_interval_right, split_interval_left)
(adjust_intervals_for_insertion, delete_node)
(interval_deletion_adjustment, adjust_intervals_for_deletion)
(merge_interval_right, merge_interval_left, copy_intervals)
(set_intervals_multibyte_1): Likewise.
* keyboard.c (gobble_input, append_tool_bar_item): Likewise.
* keymap.c (Fkey_description): Likewise.
* lisp.h (FIXNUM_OVERFLOW_P, vcopy): Likewise.
* lread.c (openp, read_integer, read1, string_to_number):
Likewise.
* menu.c (ensure_menu_items): Likewise.
* minibuf.c (read_minibuf_noninteractive): Likewise.
* print.c (printchar, strout): Likewise.
* process.c (create_process, Faccept_process_output)
(wait_reading_process_output, read_process_output, send_process)
(wait_reading_process_output): Likewise.
* profiler.c (make_log, handle_profiler_signal): Likewise.
* regex.c (re_exec): Likewise.
* regex.h: Likewise.
* search.c (looking_at_1, Freplace_match): Likewise.
* sysdep.c (get_child_status, procfs_ttyname)
(procfs_get_total_memory): Likewise.
* systime.h (EMACS_TIME_VALID_P): Likewise.
* term.c (dissociate_if_controlling_tty): Likewise.
* window.c (get_phys_cursor_glyph): Likewise.
* xdisp.c (init_iterator, redisplay_internal, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, pint2hrstr):
Likewise.
* xfns.c (Fx_window_property): Likewise.
* xmenu.c (set_frame_menubar): Likewise.
* xselect.c (x_get_window_property, x_handle_dnd_message):
Likewise.
* xsmfns.c (smc_save_yourself_CB): Likewise.
* xterm.c (x_scroll_bar_set_handle): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 70 | ||||
| -rw-r--r-- | src/alloc.c | 4 | ||||
| -rw-r--r-- | src/blockinput.h | 2 | ||||
| -rw-r--r-- | src/bytecode.c | 4 | ||||
| -rw-r--r-- | src/callproc.c | 8 | ||||
| -rw-r--r-- | src/ccl.c | 6 | ||||
| -rw-r--r-- | src/character.c | 6 | ||||
| -rw-r--r-- | src/charset.c | 2 | ||||
| -rw-r--r-- | src/cm.c | 4 | ||||
| -rw-r--r-- | src/data.c | 4 | ||||
| -rw-r--r-- | src/dired.c | 13 | ||||
| -rw-r--r-- | src/dispnew.c | 10 | ||||
| -rw-r--r-- | src/doc.c | 2 | ||||
| -rw-r--r-- | src/doprnt.c | 2 | ||||
| -rw-r--r-- | src/editfns.c | 8 | ||||
| -rw-r--r-- | src/emacsgtkfixed.c | 2 | ||||
| -rw-r--r-- | src/fileio.c | 4 | ||||
| -rw-r--r-- | src/floatfns.c | 4 | ||||
| -rw-r--r-- | src/fns.c | 12 | ||||
| -rw-r--r-- | src/font.c | 4 | ||||
| -rw-r--r-- | src/frame.c | 4 | ||||
| -rw-r--r-- | src/gtkutil.c | 2 | ||||
| -rw-r--r-- | src/indent.c | 2 | ||||
| -rw-r--r-- | src/intervals.c | 54 | ||||
| -rw-r--r-- | src/keyboard.c | 7 | ||||
| -rw-r--r-- | src/keymap.c | 2 | ||||
| -rw-r--r-- | src/lisp.h | 4 | ||||
| -rw-r--r-- | src/lread.c | 20 | ||||
| -rw-r--r-- | src/menu.c | 2 | ||||
| -rw-r--r-- | src/minibuf.c | 2 | ||||
| -rw-r--r-- | src/print.c | 8 | ||||
| -rw-r--r-- | src/process.c | 28 | ||||
| -rw-r--r-- | src/profiler.c | 4 | ||||
| -rw-r--r-- | src/regex.c | 6 | ||||
| -rw-r--r-- | src/regex.h | 2 | ||||
| -rw-r--r-- | src/search.c | 6 | ||||
| -rw-r--r-- | src/sysdep.c | 6 | ||||
| -rw-r--r-- | src/systime.h | 2 | ||||
| -rw-r--r-- | src/term.c | 2 | ||||
| -rw-r--r-- | src/window.c | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 20 | ||||
| -rw-r--r-- | src/xfns.c | 2 | ||||
| -rw-r--r-- | src/xmenu.c | 2 | ||||
| -rw-r--r-- | src/xselect.c | 4 | ||||
| -rw-r--r-- | src/xsmfns.c | 2 | ||||
| -rw-r--r-- | src/xterm.c | 2 |
46 files changed, 216 insertions, 153 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index fb1c4fdc64c..1875147dc64 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,69 @@ | |||
| 1 | 2013-03-24 Andreas Schwab <schwab@linux-m68k.org> | ||
| 2 | |||
| 3 | * alloc.c (xpalloc, Fgarbage_collect): Reorder conditions that are | ||
| 4 | written backwards. | ||
| 5 | * blockinput.h (input_blocked_p): Likewise. | ||
| 6 | * bytecode.c (exec_byte_code): Likewise. | ||
| 7 | * callproc.c (call_process_kill, call_process_cleanup) | ||
| 8 | (Fcall_process): Likewise. | ||
| 9 | * ccl.c (ccl_driver, resolve_symbol_ccl_program) | ||
| 10 | (Fccl_execute_on_string): Likewise. | ||
| 11 | * character.c (string_escape_byte8): Likewise. | ||
| 12 | * charset.c (read_hex): Likewise. | ||
| 13 | * cm.c (calccost): Likewise. | ||
| 14 | * data.c (cons_to_unsigned): Likewise. | ||
| 15 | * dired.c (directory_files_internal, file_name_completion): | ||
| 16 | Likewise. | ||
| 17 | * dispnew.c (scrolling_window, update_frame_1, Fsleep_for) | ||
| 18 | (sit_for): Likewise. | ||
| 19 | * doc.c (Fsubstitute_command_keys): Likewise. | ||
| 20 | * doprnt.c (doprnt): Likewise. | ||
| 21 | * editfns.c (hi_time, decode_time_components, Fformat): Likewise. | ||
| 22 | * emacsgtkfixed.c: Likewise. | ||
| 23 | * fileio.c (file_offset, Fwrite_region): Likewise. | ||
| 24 | * floatfns.c (Fexpt, fmod_float): Likewise. | ||
| 25 | * fns.c (larger_vector, make_hash_table, Fmake_hash_table): | ||
| 26 | Likewise. | ||
| 27 | * font.c (font_intern_prop): Likewise. | ||
| 28 | * frame.c (x_set_alpha): Likewise. | ||
| 29 | * gtkutil.c (get_utf8_string): Likewise. | ||
| 30 | * indent.c (check_display_width): Likewise. | ||
| 31 | * intervals.c (create_root_interval, rotate_right, rotate_left) | ||
| 32 | (split_interval_right, split_interval_left) | ||
| 33 | (adjust_intervals_for_insertion, delete_node) | ||
| 34 | (interval_deletion_adjustment, adjust_intervals_for_deletion) | ||
| 35 | (merge_interval_right, merge_interval_left, copy_intervals) | ||
| 36 | (set_intervals_multibyte_1): Likewise. | ||
| 37 | * keyboard.c (gobble_input, append_tool_bar_item): Likewise. | ||
| 38 | * keymap.c (Fkey_description): Likewise. | ||
| 39 | * lisp.h (FIXNUM_OVERFLOW_P, vcopy): Likewise. | ||
| 40 | * lread.c (openp, read_integer, read1, string_to_number): | ||
| 41 | Likewise. | ||
| 42 | * menu.c (ensure_menu_items): Likewise. | ||
| 43 | * minibuf.c (read_minibuf_noninteractive): Likewise. | ||
| 44 | * print.c (printchar, strout): Likewise. | ||
| 45 | * process.c (create_process, Faccept_process_output) | ||
| 46 | (wait_reading_process_output, read_process_output, send_process) | ||
| 47 | (wait_reading_process_output): Likewise. | ||
| 48 | * profiler.c (make_log, handle_profiler_signal): Likewise. | ||
| 49 | * regex.c (re_exec): Likewise. | ||
| 50 | * regex.h: Likewise. | ||
| 51 | * search.c (looking_at_1, Freplace_match): Likewise. | ||
| 52 | * sysdep.c (get_child_status, procfs_ttyname) | ||
| 53 | (procfs_get_total_memory): Likewise. | ||
| 54 | * systime.h (EMACS_TIME_VALID_P): Likewise. | ||
| 55 | * term.c (dissociate_if_controlling_tty): Likewise. | ||
| 56 | * window.c (get_phys_cursor_glyph): Likewise. | ||
| 57 | * xdisp.c (init_iterator, redisplay_internal, redisplay_window) | ||
| 58 | (try_window_reusing_current_matrix, try_window_id, pint2hrstr): | ||
| 59 | Likewise. | ||
| 60 | * xfns.c (Fx_window_property): Likewise. | ||
| 61 | * xmenu.c (set_frame_menubar): Likewise. | ||
| 62 | * xselect.c (x_get_window_property, x_handle_dnd_message): | ||
| 63 | Likewise. | ||
| 64 | * xsmfns.c (smc_save_yourself_CB): Likewise. | ||
| 65 | * xterm.c (x_scroll_bar_set_handle): Likewise. | ||
| 66 | |||
| 1 | 2013-03-24 Dmitry Antipov <dmantipov@yandex.ru> | 67 | 2013-03-24 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 68 | ||
| 3 | * xfaces.c (Finternal_face_x_get_resource): Allow 3rd (frame) argument | 69 | * xfaces.c (Finternal_face_x_get_resource): Allow 3rd (frame) argument |
| @@ -5273,8 +5339,8 @@ | |||
| 5273 | a public macro and no need to inline by hand. | 5339 | a public macro and no need to inline by hand. |
| 5274 | 5340 | ||
| 5275 | 2012-09-26 Tomohiro Matsuyama <tomo@cx4a.org> | 5341 | 2012-09-26 Tomohiro Matsuyama <tomo@cx4a.org> |
| 5276 | Stefan Monnier <monnier@iro.umontreal.ca> | 5342 | Stefan Monnier <monnier@iro.umontreal.ca> |
| 5277 | Juanma Barranquero <lekktu@gmail.com> | 5343 | Juanma Barranquero <lekktu@gmail.com> |
| 5278 | 5344 | ||
| 5279 | * profiler.c: New file. | 5345 | * profiler.c: New file. |
| 5280 | * Makefile.in (base_obj): Add profiler.o. | 5346 | * Makefile.in (base_obj): Add profiler.o. |
diff --git a/src/alloc.c b/src/alloc.c index 4245b3069fa..ea833c62b94 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -779,7 +779,7 @@ xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min, | |||
| 779 | ptrdiff_t nitems_incr_max = n_max - n; | 779 | ptrdiff_t nitems_incr_max = n_max - n; |
| 780 | ptrdiff_t incr = max (nitems_incr_min, min (incr_estimate, nitems_incr_max)); | 780 | ptrdiff_t incr = max (nitems_incr_min, min (incr_estimate, nitems_incr_max)); |
| 781 | 781 | ||
| 782 | eassert (0 < item_size && 0 < nitems_incr_min && 0 <= n && -1 <= nitems_max); | 782 | eassert (item_size > 0 && nitems_incr_min > 0 && n >= 0 && nitems_max >= -1); |
| 783 | if (! pa) | 783 | if (! pa) |
| 784 | *nitems = 0; | 784 | *nitems = 0; |
| 785 | if (nitems_incr_max < incr) | 785 | if (nitems_incr_max < incr) |
| @@ -5376,7 +5376,7 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5376 | double tot = total_bytes_of_live_objects (); | 5376 | double tot = total_bytes_of_live_objects (); |
| 5377 | 5377 | ||
| 5378 | tot *= XFLOAT_DATA (Vgc_cons_percentage); | 5378 | tot *= XFLOAT_DATA (Vgc_cons_percentage); |
| 5379 | if (0 < tot) | 5379 | if (tot > 0) |
| 5380 | { | 5380 | { |
| 5381 | if (tot < TYPE_MAXIMUM (EMACS_INT)) | 5381 | if (tot < TYPE_MAXIMUM (EMACS_INT)) |
| 5382 | gc_relative_threshold = tot; | 5382 | gc_relative_threshold = tot; |
diff --git a/src/blockinput.h b/src/blockinput.h index 192c813073d..6dc22c6f5dd 100644 --- a/src/blockinput.h +++ b/src/blockinput.h | |||
| @@ -67,7 +67,7 @@ extern void unblock_input_to (int); | |||
| 67 | BLOCKINPUT_INLINE bool | 67 | BLOCKINPUT_INLINE bool |
| 68 | input_blocked_p (void) | 68 | input_blocked_p (void) |
| 69 | { | 69 | { |
| 70 | return 0 < interrupt_input_blocked; | 70 | return interrupt_input_blocked > 0; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | INLINE_HEADER_END | 73 | INLINE_HEADER_END |
diff --git a/src/bytecode.c b/src/bytecode.c index acb96c1e61b..7676c8550a4 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -660,7 +660,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 660 | the table clearer. */ | 660 | the table clearer. */ |
| 661 | #define LABEL(OP) [OP] = &&insn_ ## OP | 661 | #define LABEL(OP) [OP] = &&insn_ ## OP |
| 662 | 662 | ||
| 663 | #if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ | 663 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) |
| 664 | # pragma GCC diagnostic push | 664 | # pragma GCC diagnostic push |
| 665 | # pragma GCC diagnostic ignored "-Woverride-init" | 665 | # pragma GCC diagnostic ignored "-Woverride-init" |
| 666 | #endif | 666 | #endif |
| @@ -676,7 +676,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 676 | #undef DEFINE | 676 | #undef DEFINE |
| 677 | }; | 677 | }; |
| 678 | 678 | ||
| 679 | #if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ | 679 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) |
| 680 | # pragma GCC diagnostic pop | 680 | # pragma GCC diagnostic pop |
| 681 | #endif | 681 | #endif |
| 682 | 682 | ||
diff --git a/src/callproc.c b/src/callproc.c index 9132c0dd976..46a37701a40 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Synchronous subprocess invocation for GNU Emacs. | 1 | /* Synchronous subprocess invocation for GNU Emacs. |
| 2 | Copyright (C) 1985-1988, 1993-1995, 1999-2012 | 2 | Copyright (C) 1985-1988, 1993-1995, 1999-2013 |
| 3 | Free Software Foundation, Inc. | 3 | Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| @@ -125,7 +125,7 @@ record_kill_process (struct Lisp_Process *p) | |||
| 125 | static Lisp_Object | 125 | static Lisp_Object |
| 126 | call_process_kill (Lisp_Object ignored) | 126 | call_process_kill (Lisp_Object ignored) |
| 127 | { | 127 | { |
| 128 | if (0 <= synch_process_fd) | 128 | if (synch_process_fd >= 0) |
| 129 | emacs_close (synch_process_fd); | 129 | emacs_close (synch_process_fd); |
| 130 | 130 | ||
| 131 | if (synch_process_pid) | 131 | if (synch_process_pid) |
| @@ -173,7 +173,7 @@ call_process_cleanup (Lisp_Object arg) | |||
| 173 | } | 173 | } |
| 174 | #endif | 174 | #endif |
| 175 | 175 | ||
| 176 | if (0 <= synch_process_fd) | 176 | if (synch_process_fd >= 0) |
| 177 | emacs_close (synch_process_fd); | 177 | emacs_close (synch_process_fd); |
| 178 | 178 | ||
| 179 | #ifdef MSDOS | 179 | #ifdef MSDOS |
| @@ -682,7 +682,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 682 | 682 | ||
| 683 | child_errno = errno; | 683 | child_errno = errno; |
| 684 | 684 | ||
| 685 | if (0 < pid) | 685 | if (pid > 0) |
| 686 | { | 686 | { |
| 687 | if (INTEGERP (buffer)) | 687 | if (INTEGERP (buffer)) |
| 688 | record_deleted_pid (pid); | 688 | record_deleted_pid (pid); |
| @@ -1668,7 +1668,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1668 | } | 1668 | } |
| 1669 | map = XCDR (map); | 1669 | map = XCDR (map); |
| 1670 | if (! (VECTORP (map) | 1670 | if (! (VECTORP (map) |
| 1671 | && 0 < ASIZE (map) | 1671 | && ASIZE (map) > 0 |
| 1672 | && INTEGERP (AREF (map, 0)) | 1672 | && INTEGERP (AREF (map, 0)) |
| 1673 | && XINT (AREF (map, 0)) <= op | 1673 | && XINT (AREF (map, 0)) <= op |
| 1674 | && op - XINT (AREF (map, 0)) + 1 < ASIZE (map))) | 1674 | && op - XINT (AREF (map, 0)) + 1 < ASIZE (map))) |
| @@ -1867,7 +1867,7 @@ resolve_symbol_ccl_program (Lisp_Object ccl) | |||
| 1867 | return Qnil; | 1867 | return Qnil; |
| 1868 | } | 1868 | } |
| 1869 | 1869 | ||
| 1870 | if (! (0 <= XINT (AREF (result, CCL_HEADER_BUF_MAG)) | 1870 | if (! (XINT (AREF (result, CCL_HEADER_BUF_MAG)) >= 0 |
| 1871 | && ASCENDING_ORDER (0, XINT (AREF (result, CCL_HEADER_EOF)), | 1871 | && ASCENDING_ORDER (0, XINT (AREF (result, CCL_HEADER_EOF)), |
| 1872 | ASIZE (ccl)))) | 1872 | ASIZE (ccl)))) |
| 1873 | return Qnil; | 1873 | return Qnil; |
| @@ -2130,7 +2130,7 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY | |||
| 2130 | produced_chars += ccl.produced; | 2130 | produced_chars += ccl.produced; |
| 2131 | offset = outp - outbuf; | 2131 | offset = outp - outbuf; |
| 2132 | shortfall = ccl.produced * max_expansion - (outbufsize - offset); | 2132 | shortfall = ccl.produced * max_expansion - (outbufsize - offset); |
| 2133 | if (0 < shortfall) | 2133 | if (shortfall > 0) |
| 2134 | { | 2134 | { |
| 2135 | outbuf = xpalloc (outbuf, &outbufsize, shortfall, -1, 1); | 2135 | outbuf = xpalloc (outbuf, &outbufsize, shortfall, -1, 1); |
| 2136 | outp = outbuf + offset; | 2136 | outp = outbuf + offset; |
diff --git a/src/character.c b/src/character.c index b2caaa290af..5a06c7f4d6c 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -833,8 +833,8 @@ string_escape_byte8 (Lisp_Object string) | |||
| 833 | 833 | ||
| 834 | if (multibyte) | 834 | if (multibyte) |
| 835 | { | 835 | { |
| 836 | if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count | 836 | if (byte8_count > (MOST_POSITIVE_FIXNUM - nchars) / 3 |
| 837 | || (STRING_BYTES_BOUND - nbytes) / 2 < byte8_count) | 837 | || byte8_count > (STRING_BYTES_BOUND - nbytes) / 2) |
| 838 | string_overflow (); | 838 | string_overflow (); |
| 839 | 839 | ||
| 840 | /* Convert 2-byte sequence of byte8 chars to 4-byte octal. */ | 840 | /* Convert 2-byte sequence of byte8 chars to 4-byte octal. */ |
| @@ -843,7 +843,7 @@ string_escape_byte8 (Lisp_Object string) | |||
| 843 | } | 843 | } |
| 844 | else | 844 | else |
| 845 | { | 845 | { |
| 846 | if ((STRING_BYTES_BOUND - nbytes) / 3 < byte8_count) | 846 | if (byte8_count > (STRING_BYTES_BOUND - nbytes) / 3) |
| 847 | string_overflow (); | 847 | string_overflow (); |
| 848 | 848 | ||
| 849 | /* Convert 1-byte sequence of byte8 chars to 4-byte octal. */ | 849 | /* Convert 1-byte sequence of byte8 chars to 4-byte octal. */ |
diff --git a/src/charset.c b/src/charset.c index fdb8eebde8b..3d43d81877f 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -447,7 +447,7 @@ read_hex (FILE *fp, bool *eof, bool *overflow) | |||
| 447 | n = 0; | 447 | n = 0; |
| 448 | while (c_isxdigit (c = getc (fp))) | 448 | while (c_isxdigit (c = getc (fp))) |
| 449 | { | 449 | { |
| 450 | if (UINT_MAX >> 4 < n) | 450 | if (n > UINT_MAX >> 4) |
| 451 | *overflow = 1; | 451 | *overflow = 1; |
| 452 | n = ((n << 4) | 452 | n = ((n << 4) |
| 453 | | (c - ('0' <= c && c <= '9' ? '0' | 453 | | (c - ('0' <= c && c <= '9' ? '0' |
| @@ -214,7 +214,7 @@ calccost (struct tty_display_info *tty, | |||
| 214 | if (doit) | 214 | if (doit) |
| 215 | do | 215 | do |
| 216 | emacs_tputs (tty, p, 1, cmputc); | 216 | emacs_tputs (tty, p, 1, cmputc); |
| 217 | while (0 < --deltay); | 217 | while (--deltay > 0); |
| 218 | x: | 218 | x: |
| 219 | if ((deltax = dstx - srcx) == 0) | 219 | if ((deltax = dstx - srcx) == 0) |
| 220 | goto done; | 220 | goto done; |
| @@ -297,7 +297,7 @@ fail: | |||
| 297 | if (doit) | 297 | if (doit) |
| 298 | do | 298 | do |
| 299 | emacs_tputs (tty, p, 1, cmputc); | 299 | emacs_tputs (tty, p, 1, cmputc); |
| 300 | while (0 < --deltax); | 300 | while (--deltax > 0); |
| 301 | done: | 301 | done: |
| 302 | return totalcost; | 302 | return totalcost; |
| 303 | } | 303 | } |
diff --git a/src/data.c b/src/data.c index 6622088b648..b20d1b4c8af 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -2337,13 +2337,13 @@ cons_to_unsigned (Lisp_Object c, uintmax_t max) | |||
| 2337 | uintmax_t val IF_LINT (= 0); | 2337 | uintmax_t val IF_LINT (= 0); |
| 2338 | if (INTEGERP (c)) | 2338 | if (INTEGERP (c)) |
| 2339 | { | 2339 | { |
| 2340 | valid = 0 <= XINT (c); | 2340 | valid = XINT (c) >= 0; |
| 2341 | val = XINT (c); | 2341 | val = XINT (c); |
| 2342 | } | 2342 | } |
| 2343 | else if (FLOATP (c)) | 2343 | else if (FLOATP (c)) |
| 2344 | { | 2344 | { |
| 2345 | double d = XFLOAT_DATA (c); | 2345 | double d = XFLOAT_DATA (c); |
| 2346 | if (0 <= d | 2346 | if (d >= 0 |
| 2347 | && d < (max == UINTMAX_MAX ? (double) UINTMAX_MAX + 1 : max + 1)) | 2347 | && d < (max == UINTMAX_MAX ? (double) UINTMAX_MAX + 1 : max + 1)) |
| 2348 | { | 2348 | { |
| 2349 | val = d; | 2349 | val = d; |
diff --git a/src/dired.c b/src/dired.c index 0e37568f211..ab48488966b 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -258,7 +258,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, | |||
| 258 | QUIT; | 258 | QUIT; |
| 259 | 259 | ||
| 260 | if (NILP (match) | 260 | if (NILP (match) |
| 261 | || (0 <= re_search (bufp, SSDATA (name), len, 0, len, 0))) | 261 | || re_search (bufp, SSDATA (name), len, 0, len, 0) >= 0) |
| 262 | wanted = 1; | 262 | wanted = 1; |
| 263 | 263 | ||
| 264 | immediate_quit = 0; | 264 | immediate_quit = 0; |
| @@ -517,8 +517,8 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, | |||
| 517 | 517 | ||
| 518 | QUIT; | 518 | QUIT; |
| 519 | if (len < SCHARS (encoded_file) | 519 | if (len < SCHARS (encoded_file) |
| 520 | || 0 <= scmp (dp->d_name, SSDATA (encoded_file), | 520 | || scmp (dp->d_name, SSDATA (encoded_file), |
| 521 | SCHARS (encoded_file))) | 521 | SCHARS (encoded_file)) >= 0) |
| 522 | continue; | 522 | continue; |
| 523 | 523 | ||
| 524 | if (file_name_completion_stat (fd, dp, &st) < 0) | 524 | if (file_name_completion_stat (fd, dp, &st) < 0) |
| @@ -580,7 +580,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, | |||
| 580 | if (skip < 0) | 580 | if (skip < 0) |
| 581 | continue; | 581 | continue; |
| 582 | 582 | ||
| 583 | if (0 <= scmp (dp->d_name + skip, p1, elt_len)) | 583 | if (scmp (dp->d_name + skip, p1, elt_len) >= 0) |
| 584 | continue; | 584 | continue; |
| 585 | break; | 585 | break; |
| 586 | } | 586 | } |
| @@ -602,9 +602,8 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, | |||
| 602 | skip = len - SCHARS (elt); | 602 | skip = len - SCHARS (elt); |
| 603 | if (skip < 0) continue; | 603 | if (skip < 0) continue; |
| 604 | 604 | ||
| 605 | if (0 <= scmp (dp->d_name + skip, | 605 | if (scmp (dp->d_name + skip, SSDATA (elt), SCHARS (elt)) |
| 606 | SSDATA (elt), | 606 | >= 0) |
| 607 | SCHARS (elt))) | ||
| 608 | continue; | 607 | continue; |
| 609 | break; | 608 | break; |
| 610 | } | 609 | } |
diff --git a/src/dispnew.c b/src/dispnew.c index 41d4844707e..852598d2dc8 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -4459,7 +4459,7 @@ scrolling_window (struct window *w, bool header_line_p) | |||
| 4459 | row_table[row_entry_pool[i].bucket] = NULL; | 4459 | row_table[row_entry_pool[i].bucket] = NULL; |
| 4460 | 4460 | ||
| 4461 | /* Value is 1 to indicate that we scrolled the display. */ | 4461 | /* Value is 1 to indicate that we scrolled the display. */ |
| 4462 | return 0 < nruns; | 4462 | return nruns > 0; |
| 4463 | } | 4463 | } |
| 4464 | 4464 | ||
| 4465 | 4465 | ||
| @@ -4545,7 +4545,7 @@ update_frame_1 (struct frame *f, bool force_p, bool inhibit_id_p) | |||
| 4545 | } | 4545 | } |
| 4546 | } | 4546 | } |
| 4547 | 4547 | ||
| 4548 | lint_assume (0 <= FRAME_LINES (f)); | 4548 | lint_assume (FRAME_LINES (f) >= 0); |
| 4549 | pause_p = 0 < i && i < FRAME_LINES (f) - 1; | 4549 | pause_p = 0 < i && i < FRAME_LINES (f) - 1; |
| 4550 | 4550 | ||
| 4551 | /* Now just clean up termcap drivers and set cursor, etc. */ | 4551 | /* Now just clean up termcap drivers and set cursor, etc. */ |
| @@ -5764,7 +5764,7 @@ additional wait period, in milliseconds; this is for backwards compatibility. | |||
| 5764 | duration += XINT (milliseconds) / 1000.0; | 5764 | duration += XINT (milliseconds) / 1000.0; |
| 5765 | } | 5765 | } |
| 5766 | 5766 | ||
| 5767 | if (0 < duration) | 5767 | if (duration > 0) |
| 5768 | { | 5768 | { |
| 5769 | EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (duration); | 5769 | EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (duration); |
| 5770 | wait_reading_process_output (min (EMACS_SECS (t), WAIT_READING_MAX), | 5770 | wait_reading_process_output (min (EMACS_SECS (t), WAIT_READING_MAX), |
| @@ -5804,14 +5804,14 @@ sit_for (Lisp_Object timeout, bool reading, int display_option) | |||
| 5804 | if (INTEGERP (timeout)) | 5804 | if (INTEGERP (timeout)) |
| 5805 | { | 5805 | { |
| 5806 | sec = XINT (timeout); | 5806 | sec = XINT (timeout); |
| 5807 | if (! (0 < sec)) | 5807 | if (sec <= 0) |
| 5808 | return Qt; | 5808 | return Qt; |
| 5809 | nsec = 0; | 5809 | nsec = 0; |
| 5810 | } | 5810 | } |
| 5811 | else if (FLOATP (timeout)) | 5811 | else if (FLOATP (timeout)) |
| 5812 | { | 5812 | { |
| 5813 | double seconds = XFLOAT_DATA (timeout); | 5813 | double seconds = XFLOAT_DATA (timeout); |
| 5814 | if (! (0 < seconds)) | 5814 | if (seconds <= 0) |
| 5815 | return Qt; | 5815 | return Qt; |
| 5816 | else | 5816 | else |
| 5817 | { | 5817 | { |
| @@ -826,7 +826,7 @@ Otherwise, return a new string, without any text properties. */) | |||
| 826 | if (NILP (tem)) /* but not on any keys */ | 826 | if (NILP (tem)) /* but not on any keys */ |
| 827 | { | 827 | { |
| 828 | ptrdiff_t offset = bufp - buf; | 828 | ptrdiff_t offset = bufp - buf; |
| 829 | if (STRING_BYTES_BOUND - 4 < bsize) | 829 | if (bsize > STRING_BYTES_BOUND - 4) |
| 830 | string_overflow (); | 830 | string_overflow (); |
| 831 | buf = xrealloc (buf, bsize += 4); | 831 | buf = xrealloc (buf, bsize += 4); |
| 832 | bufp = buf + offset; | 832 | bufp = buf + offset; |
diff --git a/src/doprnt.c b/src/doprnt.c index 471e35c7b43..087256ced2a 100644 --- a/src/doprnt.c +++ b/src/doprnt.c | |||
| @@ -361,7 +361,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format, | |||
| 361 | 361 | ||
| 362 | /* Copy string into final output, truncating if no room. */ | 362 | /* Copy string into final output, truncating if no room. */ |
| 363 | doit: | 363 | doit: |
| 364 | eassert (0 <= tem); | 364 | eassert (tem >= 0); |
| 365 | /* Coming here means STRING contains ASCII only. */ | 365 | /* Coming here means STRING contains ASCII only. */ |
| 366 | if (STRING_BYTES_BOUND < tem) | 366 | if (STRING_BYTES_BOUND < tem) |
| 367 | error ("Format width or precision too large"); | 367 | error ("Format width or precision too large"); |
diff --git a/src/editfns.c b/src/editfns.c index 6357a28e8ea..2d87b8e0064 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -1398,8 +1398,8 @@ hi_time (time_t t) | |||
| 1398 | no runtime check is needed, and taking care not to convert | 1398 | no runtime check is needed, and taking care not to convert |
| 1399 | negative numbers to unsigned before comparing them. */ | 1399 | negative numbers to unsigned before comparing them. */ |
| 1400 | if (! ((! TYPE_SIGNED (time_t) | 1400 | if (! ((! TYPE_SIGNED (time_t) |
| 1401 | || MOST_NEGATIVE_FIXNUM <= TIME_T_MIN >> 16 | 1401 | || TIME_T_MIN >> 16 >= MOST_NEGATIVE_FIXNUM |
| 1402 | || MOST_NEGATIVE_FIXNUM <= hi) | 1402 | || hi >= MOST_NEGATIVE_FIXNUM) |
| 1403 | && (TIME_T_MAX >> 16 <= MOST_POSITIVE_FIXNUM | 1403 | && (TIME_T_MAX >> 16 <= MOST_POSITIVE_FIXNUM |
| 1404 | || hi <= MOST_POSITIVE_FIXNUM))) | 1404 | || hi <= MOST_POSITIVE_FIXNUM))) |
| 1405 | time_overflow (); | 1405 | time_overflow (); |
| @@ -1561,7 +1561,7 @@ decode_time_components (Lisp_Object high, Lisp_Object low, Lisp_Object usec, | |||
| 1561 | 1561 | ||
| 1562 | if (result) | 1562 | if (result) |
| 1563 | { | 1563 | { |
| 1564 | if ((TYPE_SIGNED (time_t) ? TIME_T_MIN >> 16 <= hi : 0 <= hi) | 1564 | if (hi >= (TYPE_SIGNED (time_t) ? TIME_T_MIN >> 16 : 0) |
| 1565 | && hi <= TIME_T_MAX >> 16) | 1565 | && hi <= TIME_T_MAX >> 16) |
| 1566 | { | 1566 | { |
| 1567 | /* Return the greatest representable time that is not greater | 1567 | /* Return the greatest representable time that is not greater |
| @@ -3958,7 +3958,7 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3958 | trailing "d"). */ | 3958 | trailing "d"). */ |
| 3959 | pMlen = sizeof pMd - 2 | 3959 | pMlen = sizeof pMd - 2 |
| 3960 | }; | 3960 | }; |
| 3961 | verify (0 < USEFUL_PRECISION_MAX); | 3961 | verify (USEFUL_PRECISION_MAX > 0); |
| 3962 | 3962 | ||
| 3963 | int prec; | 3963 | int prec; |
| 3964 | ptrdiff_t padding, sprintf_bytes; | 3964 | ptrdiff_t padding, sprintf_bytes; |
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c index 6a8c751e306..970683da9c4 100644 --- a/src/emacsgtkfixed.c +++ b/src/emacsgtkfixed.c | |||
| @@ -28,7 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 28 | #include "xterm.h" | 28 | #include "xterm.h" |
| 29 | 29 | ||
| 30 | /* Silence a bogus diagnostic; see GNOME bug 683906. */ | 30 | /* Silence a bogus diagnostic; see GNOME bug 683906. */ |
| 31 | #if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ | 31 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) |
| 32 | # pragma GCC diagnostic push | 32 | # pragma GCC diagnostic push |
| 33 | # pragma GCC diagnostic ignored "-Wunused-local-typedefs" | 33 | # pragma GCC diagnostic ignored "-Wunused-local-typedefs" |
| 34 | #endif | 34 | #endif |
diff --git a/src/fileio.c b/src/fileio.c index 3d7bd9fe216..1919768d98a 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3449,7 +3449,7 @@ file_offset (Lisp_Object val) | |||
| 3449 | if (FLOATP (val)) | 3449 | if (FLOATP (val)) |
| 3450 | { | 3450 | { |
| 3451 | double v = XFLOAT_DATA (val); | 3451 | double v = XFLOAT_DATA (val); |
| 3452 | if (0 <= v | 3452 | if (v >= 0 |
| 3453 | && (sizeof (off_t) < sizeof v | 3453 | && (sizeof (off_t) < sizeof v |
| 3454 | ? v <= TYPE_MAXIMUM (off_t) | 3454 | ? v <= TYPE_MAXIMUM (off_t) |
| 3455 | : v < TYPE_MAXIMUM (off_t))) | 3455 | : v < TYPE_MAXIMUM (off_t))) |
| @@ -5013,7 +5013,7 @@ This calls `write-region-annotate-functions' at the start, and | |||
| 5013 | && ! (valid_timestamp_file_system && st.st_dev == timestamp_file_system)) | 5013 | && ! (valid_timestamp_file_system && st.st_dev == timestamp_file_system)) |
| 5014 | { | 5014 | { |
| 5015 | int desc1 = emacs_open (fn, O_WRONLY | O_BINARY, 0); | 5015 | int desc1 = emacs_open (fn, O_WRONLY | O_BINARY, 0); |
| 5016 | if (0 <= desc1) | 5016 | if (desc1 >= 0) |
| 5017 | { | 5017 | { |
| 5018 | struct stat st1; | 5018 | struct stat st1; |
| 5019 | if (fstat (desc1, &st1) == 0 | 5019 | if (fstat (desc1, &st1) == 0 |
diff --git a/src/floatfns.c b/src/floatfns.c index 43576a16248..6113758f964 100644 --- a/src/floatfns.c +++ b/src/floatfns.c | |||
| @@ -193,7 +193,7 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, | |||
| 193 | CHECK_NUMBER_OR_FLOAT (arg2); | 193 | CHECK_NUMBER_OR_FLOAT (arg2); |
| 194 | if (INTEGERP (arg1) /* common lisp spec */ | 194 | if (INTEGERP (arg1) /* common lisp spec */ |
| 195 | && INTEGERP (arg2) /* don't promote, if both are ints, and */ | 195 | && INTEGERP (arg2) /* don't promote, if both are ints, and */ |
| 196 | && 0 <= XINT (arg2)) /* we are sure the result is not fractional */ | 196 | && XINT (arg2) >= 0) /* we are sure the result is not fractional */ |
| 197 | { /* this can be improved by pre-calculating */ | 197 | { /* this can be improved by pre-calculating */ |
| 198 | EMACS_INT y; /* some binary powers of x then accumulating */ | 198 | EMACS_INT y; /* some binary powers of x then accumulating */ |
| 199 | EMACS_UINT acc, x; /* Unsigned so that overflow is well defined. */ | 199 | EMACS_UINT acc, x; /* Unsigned so that overflow is well defined. */ |
| @@ -475,7 +475,7 @@ fmod_float (Lisp_Object x, Lisp_Object y) | |||
| 475 | f1 = fmod (f1, f2); | 475 | f1 = fmod (f1, f2); |
| 476 | 476 | ||
| 477 | /* If the "remainder" comes out with the wrong sign, fix it. */ | 477 | /* If the "remainder" comes out with the wrong sign, fix it. */ |
| 478 | if (f2 < 0 ? 0 < f1 : f1 < 0) | 478 | if (f2 < 0 ? f1 > 0 : f1 < 0) |
| 479 | f1 += f2; | 479 | f1 += f2; |
| 480 | 480 | ||
| 481 | return make_float (f1); | 481 | return make_float (f1); |
| @@ -3409,7 +3409,7 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max) | |||
| 3409 | ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max | 3409 | ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max |
| 3410 | ? nitems_max : C_language_max); | 3410 | ? nitems_max : C_language_max); |
| 3411 | eassert (VECTORP (vec)); | 3411 | eassert (VECTORP (vec)); |
| 3412 | eassert (0 < incr_min && -1 <= nitems_max); | 3412 | eassert (incr_min > 0 && nitems_max >= -1); |
| 3413 | old_size = ASIZE (vec); | 3413 | old_size = ASIZE (vec); |
| 3414 | incr_max = n_max - old_size; | 3414 | incr_max = n_max - old_size; |
| 3415 | incr = max (incr_min, min (old_size >> 1, incr_max)); | 3415 | incr = max (incr_min, min (old_size >> 1, incr_max)); |
| @@ -3574,9 +3574,9 @@ make_hash_table (struct hash_table_test test, | |||
| 3574 | eassert (SYMBOLP (test.name)); | 3574 | eassert (SYMBOLP (test.name)); |
| 3575 | eassert (INTEGERP (size) && XINT (size) >= 0); | 3575 | eassert (INTEGERP (size) && XINT (size) >= 0); |
| 3576 | eassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0) | 3576 | eassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0) |
| 3577 | || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size))); | 3577 | || (FLOATP (rehash_size) && XFLOAT_DATA (rehash_size) > 1)); |
| 3578 | eassert (FLOATP (rehash_threshold) | 3578 | eassert (FLOATP (rehash_threshold) |
| 3579 | && 0 < XFLOAT_DATA (rehash_threshold) | 3579 | && XFLOAT_DATA (rehash_threshold) > 0 |
| 3580 | && XFLOAT_DATA (rehash_threshold) <= 1.0); | 3580 | && XFLOAT_DATA (rehash_threshold) <= 1.0); |
| 3581 | 3581 | ||
| 3582 | if (XFASTINT (size) == 0) | 3582 | if (XFASTINT (size) == 0) |
| @@ -4312,15 +4312,15 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) | |||
| 4312 | /* Look for `:rehash-size SIZE'. */ | 4312 | /* Look for `:rehash-size SIZE'. */ |
| 4313 | i = get_key_arg (QCrehash_size, nargs, args, used); | 4313 | i = get_key_arg (QCrehash_size, nargs, args, used); |
| 4314 | rehash_size = i ? args[i] : make_float (DEFAULT_REHASH_SIZE); | 4314 | rehash_size = i ? args[i] : make_float (DEFAULT_REHASH_SIZE); |
| 4315 | if (! ((INTEGERP (rehash_size) && 0 < XINT (rehash_size)) | 4315 | if (! ((INTEGERP (rehash_size) && XINT (rehash_size) > 0) |
| 4316 | || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size)))) | 4316 | || (FLOATP (rehash_size) && XFLOAT_DATA (rehash_size) > 1))) |
| 4317 | signal_error ("Invalid hash table rehash size", rehash_size); | 4317 | signal_error ("Invalid hash table rehash size", rehash_size); |
| 4318 | 4318 | ||
| 4319 | /* Look for `:rehash-threshold THRESHOLD'. */ | 4319 | /* Look for `:rehash-threshold THRESHOLD'. */ |
| 4320 | i = get_key_arg (QCrehash_threshold, nargs, args, used); | 4320 | i = get_key_arg (QCrehash_threshold, nargs, args, used); |
| 4321 | rehash_threshold = i ? args[i] : make_float (DEFAULT_REHASH_THRESHOLD); | 4321 | rehash_threshold = i ? args[i] : make_float (DEFAULT_REHASH_THRESHOLD); |
| 4322 | if (! (FLOATP (rehash_threshold) | 4322 | if (! (FLOATP (rehash_threshold) |
| 4323 | && 0 < XFLOAT_DATA (rehash_threshold) | 4323 | && XFLOAT_DATA (rehash_threshold) > 0 |
| 4324 | && XFLOAT_DATA (rehash_threshold) <= 1)) | 4324 | && XFLOAT_DATA (rehash_threshold) <= 1)) |
| 4325 | signal_error ("Invalid hash table rehash threshold", rehash_threshold); | 4325 | signal_error ("Invalid hash table rehash threshold", rehash_threshold); |
| 4326 | 4326 | ||
diff --git a/src/font.c b/src/font.c index ba98d19afa0..357f8483b14 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -229,7 +229,7 @@ font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol) | |||
| 229 | 229 | ||
| 230 | if (len == 1 && *str == '*') | 230 | if (len == 1 && *str == '*') |
| 231 | return Qnil; | 231 | return Qnil; |
| 232 | if (!force_symbol && 0 < len && '0' <= *str && *str <= '9') | 232 | if (!force_symbol && len > 0 && '0' <= *str && *str <= '9') |
| 233 | { | 233 | { |
| 234 | for (i = 1; i < len; i++) | 234 | for (i = 1; i < len; i++) |
| 235 | if (! ('0' <= str[i] && str[i] <= '9')) | 235 | if (! ('0' <= str[i] && str[i] <= '9')) |
| @@ -243,7 +243,7 @@ font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol) | |||
| 243 | { | 243 | { |
| 244 | if (i == len) | 244 | if (i == len) |
| 245 | return make_number (n); | 245 | return make_number (n); |
| 246 | if (MOST_POSITIVE_FIXNUM / 10 < n) | 246 | if (n > MOST_POSITIVE_FIXNUM / 10) |
| 247 | break; | 247 | break; |
| 248 | } | 248 | } |
| 249 | 249 | ||
diff --git a/src/frame.c b/src/frame.c index 5360c1c701d..cea39144cef 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -3315,13 +3315,13 @@ x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 3315 | else if (FLOATP (item)) | 3315 | else if (FLOATP (item)) |
| 3316 | { | 3316 | { |
| 3317 | alpha = XFLOAT_DATA (item); | 3317 | alpha = XFLOAT_DATA (item); |
| 3318 | if (alpha < 0.0 || 1.0 < alpha) | 3318 | if (alpha < 0.0 || alpha > 1.0) |
| 3319 | args_out_of_range (make_float (0.0), make_float (1.0)); | 3319 | args_out_of_range (make_float (0.0), make_float (1.0)); |
| 3320 | } | 3320 | } |
| 3321 | else if (INTEGERP (item)) | 3321 | else if (INTEGERP (item)) |
| 3322 | { | 3322 | { |
| 3323 | EMACS_INT ialpha = XINT (item); | 3323 | EMACS_INT ialpha = XINT (item); |
| 3324 | if (ialpha < 0 || 100 < ialpha) | 3324 | if (ialpha < 0 || ialpha > 100) |
| 3325 | args_out_of_range (make_number (0), make_number (100)); | 3325 | args_out_of_range (make_number (0), make_number (100)); |
| 3326 | else | 3326 | else |
| 3327 | alpha = ialpha / 100.0; | 3327 | alpha = ialpha / 100.0; |
diff --git a/src/gtkutil.c b/src/gtkutil.c index d6e4dcebcd3..2bb4305e1d2 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -543,7 +543,7 @@ get_utf8_string (const char *str) | |||
| 543 | if (cp) g_free (cp); | 543 | if (cp) g_free (cp); |
| 544 | 544 | ||
| 545 | len = strlen (str); | 545 | len = strlen (str); |
| 546 | if ((min (PTRDIFF_MAX, SIZE_MAX) - len - 1) / 4 < nr_bad) | 546 | if (nr_bad > (min (PTRDIFF_MAX, SIZE_MAX) - len - 1) / 4) |
| 547 | memory_full (SIZE_MAX); | 547 | memory_full (SIZE_MAX); |
| 548 | up = utf8_str = xmalloc (len + nr_bad * 4 + 1); | 548 | up = utf8_str = xmalloc (len + nr_bad * 4 + 1); |
| 549 | p = (unsigned char *)str; | 549 | p = (unsigned char *)str; |
diff --git a/src/indent.c b/src/indent.c index d1f95da6bcf..ac448532dd4 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -476,7 +476,7 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos) | |||
| 476 | if ((prop = Fplist_get (plist, QCwidth), | 476 | if ((prop = Fplist_get (plist, QCwidth), |
| 477 | RANGED_INTEGERP (0, prop, INT_MAX))) | 477 | RANGED_INTEGERP (0, prop, INT_MAX))) |
| 478 | width = XINT (prop); | 478 | width = XINT (prop); |
| 479 | else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop) | 479 | else if (FLOATP (prop) && XFLOAT_DATA (prop) >= 0 |
| 480 | && XFLOAT_DATA (prop) <= INT_MAX) | 480 | && XFLOAT_DATA (prop) <= INT_MAX) |
| 481 | width = (int)(XFLOAT_DATA (prop) + 0.5); | 481 | width = (int)(XFLOAT_DATA (prop) + 0.5); |
| 482 | else if ((prop = Fplist_get (plist, QCalign_to), | 482 | else if ((prop = Fplist_get (plist, QCalign_to), |
diff --git a/src/intervals.c b/src/intervals.c index db38c86c00b..f65ce0ecc77 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -110,14 +110,14 @@ create_root_interval (Lisp_Object parent) | |||
| 110 | { | 110 | { |
| 111 | new->total_length = (BUF_Z (XBUFFER (parent)) | 111 | new->total_length = (BUF_Z (XBUFFER (parent)) |
| 112 | - BUF_BEG (XBUFFER (parent))); | 112 | - BUF_BEG (XBUFFER (parent))); |
| 113 | eassert (0 <= TOTAL_LENGTH (new)); | 113 | eassert (TOTAL_LENGTH (new) >= 0); |
| 114 | set_buffer_intervals (XBUFFER (parent), new); | 114 | set_buffer_intervals (XBUFFER (parent), new); |
| 115 | new->position = BEG; | 115 | new->position = BEG; |
| 116 | } | 116 | } |
| 117 | else if (STRINGP (parent)) | 117 | else if (STRINGP (parent)) |
| 118 | { | 118 | { |
| 119 | new->total_length = SCHARS (parent); | 119 | new->total_length = SCHARS (parent); |
| 120 | eassert (0 <= TOTAL_LENGTH (new)); | 120 | eassert (TOTAL_LENGTH (new) >= 0); |
| 121 | set_string_intervals (parent, new); | 121 | set_string_intervals (parent, new); |
| 122 | new->position = 0; | 122 | new->position = 0; |
| 123 | } | 123 | } |
| @@ -371,11 +371,11 @@ rotate_right (INTERVAL interval) | |||
| 371 | 371 | ||
| 372 | /* A's total length is decreased by the length of B and its left child. */ | 372 | /* A's total length is decreased by the length of B and its left child. */ |
| 373 | interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval); | 373 | interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval); |
| 374 | eassert (0 <= TOTAL_LENGTH (interval)); | 374 | eassert (TOTAL_LENGTH (interval) >= 0); |
| 375 | 375 | ||
| 376 | /* B must have the same total length of A. */ | 376 | /* B must have the same total length of A. */ |
| 377 | B->total_length = old_total; | 377 | B->total_length = old_total; |
| 378 | eassert (0 <= TOTAL_LENGTH (B)); | 378 | eassert (TOTAL_LENGTH (B) >= 0); |
| 379 | 379 | ||
| 380 | return B; | 380 | return B; |
| 381 | } | 381 | } |
| @@ -418,11 +418,11 @@ rotate_left (INTERVAL interval) | |||
| 418 | 418 | ||
| 419 | /* A's total length is decreased by the length of B and its right child. */ | 419 | /* A's total length is decreased by the length of B and its right child. */ |
| 420 | interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval); | 420 | interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval); |
| 421 | eassert (0 <= TOTAL_LENGTH (interval)); | 421 | eassert (TOTAL_LENGTH (interval) >= 0); |
| 422 | 422 | ||
| 423 | /* B must have the same total length of A. */ | 423 | /* B must have the same total length of A. */ |
| 424 | B->total_length = old_total; | 424 | B->total_length = old_total; |
| 425 | eassert (0 <= TOTAL_LENGTH (B)); | 425 | eassert (TOTAL_LENGTH (B) >= 0); |
| 426 | 426 | ||
| 427 | return B; | 427 | return B; |
| 428 | } | 428 | } |
| @@ -556,7 +556,7 @@ split_interval_right (INTERVAL interval, ptrdiff_t offset) | |||
| 556 | { | 556 | { |
| 557 | set_interval_right (interval, new); | 557 | set_interval_right (interval, new); |
| 558 | new->total_length = new_length; | 558 | new->total_length = new_length; |
| 559 | eassert (0 <= TOTAL_LENGTH (new)); | 559 | eassert (TOTAL_LENGTH (new) >= 0); |
| 560 | } | 560 | } |
| 561 | else | 561 | else |
| 562 | { | 562 | { |
| @@ -565,7 +565,7 @@ split_interval_right (INTERVAL interval, ptrdiff_t offset) | |||
| 565 | set_interval_parent (interval->right, new); | 565 | set_interval_parent (interval->right, new); |
| 566 | set_interval_right (interval, new); | 566 | set_interval_right (interval, new); |
| 567 | new->total_length = new_length + new->right->total_length; | 567 | new->total_length = new_length + new->right->total_length; |
| 568 | eassert (0 <= TOTAL_LENGTH (new)); | 568 | eassert (TOTAL_LENGTH (new) >= 0); |
| 569 | balance_an_interval (new); | 569 | balance_an_interval (new); |
| 570 | } | 570 | } |
| 571 | 571 | ||
| @@ -601,7 +601,7 @@ split_interval_left (INTERVAL interval, ptrdiff_t offset) | |||
| 601 | { | 601 | { |
| 602 | set_interval_left (interval, new); | 602 | set_interval_left (interval, new); |
| 603 | new->total_length = new_length; | 603 | new->total_length = new_length; |
| 604 | eassert (0 <= TOTAL_LENGTH (new)); | 604 | eassert (TOTAL_LENGTH (new) >= 0); |
| 605 | } | 605 | } |
| 606 | else | 606 | else |
| 607 | { | 607 | { |
| @@ -610,7 +610,7 @@ split_interval_left (INTERVAL interval, ptrdiff_t offset) | |||
| 610 | set_interval_parent (new->left, new); | 610 | set_interval_parent (new->left, new); |
| 611 | set_interval_left (interval, new); | 611 | set_interval_left (interval, new); |
| 612 | new->total_length = new_length + new->left->total_length; | 612 | new->total_length = new_length + new->left->total_length; |
| 613 | eassert (0 <= TOTAL_LENGTH (new)); | 613 | eassert (TOTAL_LENGTH (new) >= 0); |
| 614 | balance_an_interval (new); | 614 | balance_an_interval (new); |
| 615 | } | 615 | } |
| 616 | 616 | ||
| @@ -960,7 +960,7 @@ adjust_intervals_for_insertion (INTERVAL tree, | |||
| 960 | for (temp = prev ? prev : i; temp; temp = INTERVAL_PARENT_OR_NULL (temp)) | 960 | for (temp = prev ? prev : i; temp; temp = INTERVAL_PARENT_OR_NULL (temp)) |
| 961 | { | 961 | { |
| 962 | temp->total_length += length; | 962 | temp->total_length += length; |
| 963 | eassert (0 <= TOTAL_LENGTH (temp)); | 963 | eassert (TOTAL_LENGTH (temp) >= 0); |
| 964 | temp = balance_possible_root_interval (temp); | 964 | temp = balance_possible_root_interval (temp); |
| 965 | } | 965 | } |
| 966 | 966 | ||
| @@ -1016,7 +1016,7 @@ adjust_intervals_for_insertion (INTERVAL tree, | |||
| 1016 | for (temp = i; temp; temp = INTERVAL_PARENT_OR_NULL (temp)) | 1016 | for (temp = i; temp; temp = INTERVAL_PARENT_OR_NULL (temp)) |
| 1017 | { | 1017 | { |
| 1018 | temp->total_length += length; | 1018 | temp->total_length += length; |
| 1019 | eassert (0 <= TOTAL_LENGTH (temp)); | 1019 | eassert (TOTAL_LENGTH (temp) >= 0); |
| 1020 | temp = balance_possible_root_interval (temp); | 1020 | temp = balance_possible_root_interval (temp); |
| 1021 | } | 1021 | } |
| 1022 | } | 1022 | } |
| @@ -1218,7 +1218,7 @@ delete_node (register INTERVAL i) | |||
| 1218 | this = this->left; | 1218 | this = this->left; |
| 1219 | this->total_length += migrate_amt; | 1219 | this->total_length += migrate_amt; |
| 1220 | } | 1220 | } |
| 1221 | eassert (0 <= TOTAL_LENGTH (this)); | 1221 | eassert (TOTAL_LENGTH (this) >= 0); |
| 1222 | set_interval_left (this, migrate); | 1222 | set_interval_left (this, migrate); |
| 1223 | set_interval_parent (migrate, this); | 1223 | set_interval_parent (migrate, this); |
| 1224 | 1224 | ||
| @@ -1300,7 +1300,7 @@ interval_deletion_adjustment (register INTERVAL tree, register ptrdiff_t from, | |||
| 1300 | relative_position, | 1300 | relative_position, |
| 1301 | amount); | 1301 | amount); |
| 1302 | tree->total_length -= subtract; | 1302 | tree->total_length -= subtract; |
| 1303 | eassert (0 <= TOTAL_LENGTH (tree)); | 1303 | eassert (TOTAL_LENGTH (tree) >= 0); |
| 1304 | return subtract; | 1304 | return subtract; |
| 1305 | } | 1305 | } |
| 1306 | /* Right branch. */ | 1306 | /* Right branch. */ |
| @@ -1315,7 +1315,7 @@ interval_deletion_adjustment (register INTERVAL tree, register ptrdiff_t from, | |||
| 1315 | relative_position, | 1315 | relative_position, |
| 1316 | amount); | 1316 | amount); |
| 1317 | tree->total_length -= subtract; | 1317 | tree->total_length -= subtract; |
| 1318 | eassert (0 <= TOTAL_LENGTH (tree)); | 1318 | eassert (TOTAL_LENGTH (tree) >= 0); |
| 1319 | return subtract; | 1319 | return subtract; |
| 1320 | } | 1320 | } |
| 1321 | /* Here -- this node. */ | 1321 | /* Here -- this node. */ |
| @@ -1330,7 +1330,7 @@ interval_deletion_adjustment (register INTERVAL tree, register ptrdiff_t from, | |||
| 1330 | amount = my_amount; | 1330 | amount = my_amount; |
| 1331 | 1331 | ||
| 1332 | tree->total_length -= amount; | 1332 | tree->total_length -= amount; |
| 1333 | eassert (0 <= TOTAL_LENGTH (tree)); | 1333 | eassert (TOTAL_LENGTH (tree) >= 0); |
| 1334 | if (LENGTH (tree) == 0) | 1334 | if (LENGTH (tree) == 0) |
| 1335 | delete_interval (tree); | 1335 | delete_interval (tree); |
| 1336 | 1336 | ||
| @@ -1372,7 +1372,7 @@ adjust_intervals_for_deletion (struct buffer *buffer, | |||
| 1372 | if (ONLY_INTERVAL_P (tree)) | 1372 | if (ONLY_INTERVAL_P (tree)) |
| 1373 | { | 1373 | { |
| 1374 | tree->total_length -= length; | 1374 | tree->total_length -= length; |
| 1375 | eassert (0 <= TOTAL_LENGTH (tree)); | 1375 | eassert (TOTAL_LENGTH (tree) >= 0); |
| 1376 | return; | 1376 | return; |
| 1377 | } | 1377 | } |
| 1378 | 1378 | ||
| @@ -1435,19 +1435,19 @@ merge_interval_right (register INTERVAL i) | |||
| 1435 | while (! NULL_LEFT_CHILD (successor)) | 1435 | while (! NULL_LEFT_CHILD (successor)) |
| 1436 | { | 1436 | { |
| 1437 | successor->total_length += absorb; | 1437 | successor->total_length += absorb; |
| 1438 | eassert (0 <= TOTAL_LENGTH (successor)); | 1438 | eassert (TOTAL_LENGTH (successor) >= 0); |
| 1439 | successor = successor->left; | 1439 | successor = successor->left; |
| 1440 | } | 1440 | } |
| 1441 | 1441 | ||
| 1442 | successor->total_length += absorb; | 1442 | successor->total_length += absorb; |
| 1443 | eassert (0 <= TOTAL_LENGTH (successor)); | 1443 | eassert (TOTAL_LENGTH (successor) >= 0); |
| 1444 | delete_interval (i); | 1444 | delete_interval (i); |
| 1445 | return successor; | 1445 | return successor; |
| 1446 | } | 1446 | } |
| 1447 | 1447 | ||
| 1448 | /* Zero out this interval. */ | 1448 | /* Zero out this interval. */ |
| 1449 | i->total_length -= absorb; | 1449 | i->total_length -= absorb; |
| 1450 | eassert (0 <= TOTAL_LENGTH (i)); | 1450 | eassert (TOTAL_LENGTH (i) >= 0); |
| 1451 | 1451 | ||
| 1452 | successor = i; | 1452 | successor = i; |
| 1453 | while (! NULL_PARENT (successor)) /* It's above us. Subtract as | 1453 | while (! NULL_PARENT (successor)) /* It's above us. Subtract as |
| @@ -1462,7 +1462,7 @@ merge_interval_right (register INTERVAL i) | |||
| 1462 | 1462 | ||
| 1463 | successor = INTERVAL_PARENT (successor); | 1463 | successor = INTERVAL_PARENT (successor); |
| 1464 | successor->total_length -= absorb; | 1464 | successor->total_length -= absorb; |
| 1465 | eassert (0 <= TOTAL_LENGTH (successor)); | 1465 | eassert (TOTAL_LENGTH (successor) >= 0); |
| 1466 | } | 1466 | } |
| 1467 | 1467 | ||
| 1468 | /* This must be the rightmost or last interval and cannot | 1468 | /* This must be the rightmost or last interval and cannot |
| @@ -1491,19 +1491,19 @@ merge_interval_left (register INTERVAL i) | |||
| 1491 | while (! NULL_RIGHT_CHILD (predecessor)) | 1491 | while (! NULL_RIGHT_CHILD (predecessor)) |
| 1492 | { | 1492 | { |
| 1493 | predecessor->total_length += absorb; | 1493 | predecessor->total_length += absorb; |
| 1494 | eassert (0 <= TOTAL_LENGTH (predecessor)); | 1494 | eassert (TOTAL_LENGTH (predecessor) >= 0); |
| 1495 | predecessor = predecessor->right; | 1495 | predecessor = predecessor->right; |
| 1496 | } | 1496 | } |
| 1497 | 1497 | ||
| 1498 | predecessor->total_length += absorb; | 1498 | predecessor->total_length += absorb; |
| 1499 | eassert (0 <= TOTAL_LENGTH (predecessor)); | 1499 | eassert (TOTAL_LENGTH (predecessor) >= 0); |
| 1500 | delete_interval (i); | 1500 | delete_interval (i); |
| 1501 | return predecessor; | 1501 | return predecessor; |
| 1502 | } | 1502 | } |
| 1503 | 1503 | ||
| 1504 | /* Zero out this interval. */ | 1504 | /* Zero out this interval. */ |
| 1505 | i->total_length -= absorb; | 1505 | i->total_length -= absorb; |
| 1506 | eassert (0 <= TOTAL_LENGTH (i)); | 1506 | eassert (TOTAL_LENGTH (i) >= 0); |
| 1507 | 1507 | ||
| 1508 | predecessor = i; | 1508 | predecessor = i; |
| 1509 | while (! NULL_PARENT (predecessor)) /* It's above us. Go up, | 1509 | while (! NULL_PARENT (predecessor)) /* It's above us. Go up, |
| @@ -1518,7 +1518,7 @@ merge_interval_left (register INTERVAL i) | |||
| 1518 | 1518 | ||
| 1519 | predecessor = INTERVAL_PARENT (predecessor); | 1519 | predecessor = INTERVAL_PARENT (predecessor); |
| 1520 | predecessor->total_length -= absorb; | 1520 | predecessor->total_length -= absorb; |
| 1521 | eassert (0 <= TOTAL_LENGTH (predecessor)); | 1521 | eassert (TOTAL_LENGTH (predecessor) >= 0); |
| 1522 | } | 1522 | } |
| 1523 | 1523 | ||
| 1524 | /* This must be the leftmost or first interval and cannot | 1524 | /* This must be the leftmost or first interval and cannot |
| @@ -2272,7 +2272,7 @@ copy_intervals (INTERVAL tree, ptrdiff_t start, ptrdiff_t length) | |||
| 2272 | new->position = 0; | 2272 | new->position = 0; |
| 2273 | got = (LENGTH (i) - (start - i->position)); | 2273 | got = (LENGTH (i) - (start - i->position)); |
| 2274 | new->total_length = length; | 2274 | new->total_length = length; |
| 2275 | eassert (0 <= TOTAL_LENGTH (new)); | 2275 | eassert (TOTAL_LENGTH (new) >= 0); |
| 2276 | copy_properties (i, new); | 2276 | copy_properties (i, new); |
| 2277 | 2277 | ||
| 2278 | t = new; | 2278 | t = new; |
| @@ -2355,7 +2355,7 @@ set_intervals_multibyte_1 (INTERVAL i, bool multi_flag, | |||
| 2355 | i->total_length = end - start; | 2355 | i->total_length = end - start; |
| 2356 | else | 2356 | else |
| 2357 | i->total_length = end_byte - start_byte; | 2357 | i->total_length = end_byte - start_byte; |
| 2358 | eassert (0 <= TOTAL_LENGTH (i)); | 2358 | eassert (TOTAL_LENGTH (i) >= 0); |
| 2359 | 2359 | ||
| 2360 | if (TOTAL_LENGTH (i) == 0) | 2360 | if (TOTAL_LENGTH (i) == 0) |
| 2361 | { | 2361 | { |
diff --git a/src/keyboard.c b/src/keyboard.c index e43b7a73172..d9187cd96b4 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -6766,7 +6766,7 @@ gobble_input (void) | |||
| 6766 | hold_quit.kind = NO_EVENT; | 6766 | hold_quit.kind = NO_EVENT; |
| 6767 | 6767 | ||
| 6768 | /* No need for FIONREAD or fcntl; just say don't wait. */ | 6768 | /* No need for FIONREAD or fcntl; just say don't wait. */ |
| 6769 | while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit))) | 6769 | while ((nr = (*t->read_socket_hook) (t, &hold_quit)) > 0) |
| 6770 | nread += nr; | 6770 | nread += nr; |
| 6771 | 6771 | ||
| 6772 | if (nr == -1) /* Not OK to read input now. */ | 6772 | if (nr == -1) /* Not OK to read input now. */ |
| @@ -8240,9 +8240,8 @@ append_tool_bar_item (void) | |||
| 8240 | - (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS)); | 8240 | - (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS)); |
| 8241 | 8241 | ||
| 8242 | /* Enlarge tool_bar_items_vector if necessary. */ | 8242 | /* Enlarge tool_bar_items_vector if necessary. */ |
| 8243 | if (0 < incr) | 8243 | if (incr > 0) |
| 8244 | tool_bar_items_vector | 8244 | tool_bar_items_vector = larger_vector (tool_bar_items_vector, incr, -1); |
| 8245 | = larger_vector (tool_bar_items_vector, incr, -1); | ||
| 8246 | 8245 | ||
| 8247 | /* Append entries from tool_bar_item_properties to the end of | 8246 | /* Append entries from tool_bar_item_properties to the end of |
| 8248 | tool_bar_items_vector. */ | 8247 | tool_bar_items_vector. */ |
diff --git a/src/keymap.c b/src/keymap.c index 34406a5fc70..110c8f43729 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -2063,7 +2063,7 @@ For an approximate inverse of this, see `kbd'. */) | |||
| 2063 | size += XINT (Flength (prefix)); | 2063 | size += XINT (Flength (prefix)); |
| 2064 | 2064 | ||
| 2065 | /* This has one extra element at the end that we don't pass to Fconcat. */ | 2065 | /* This has one extra element at the end that we don't pass to Fconcat. */ |
| 2066 | if (min (PTRDIFF_MAX, SIZE_MAX) / word_size / 4 < size) | 2066 | if (size > min (PTRDIFF_MAX, SIZE_MAX) / word_size / 4) |
| 2067 | memory_full (SIZE_MAX); | 2067 | memory_full (SIZE_MAX); |
| 2068 | SAFE_ALLOCA_LISP (args, size * 4); | 2068 | SAFE_ALLOCA_LISP (args, size * 4); |
| 2069 | 2069 | ||
diff --git a/src/lisp.h b/src/lisp.h index 467710f52f4..897addc90c1 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -543,7 +543,7 @@ static EMACS_INT const VALMASK | |||
| 543 | type or if I is a NaN. */ | 543 | type or if I is a NaN. */ |
| 544 | 544 | ||
| 545 | #define FIXNUM_OVERFLOW_P(i) \ | 545 | #define FIXNUM_OVERFLOW_P(i) \ |
| 546 | (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <= MOST_POSITIVE_FIXNUM)) | 546 | (! (((i) >= 0 || (i) >= MOST_NEGATIVE_FIXNUM) && (i) <= MOST_POSITIVE_FIXNUM)) |
| 547 | 547 | ||
| 548 | LISP_INLINE ptrdiff_t | 548 | LISP_INLINE ptrdiff_t |
| 549 | clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) | 549 | clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) |
| @@ -2565,7 +2565,7 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) | |||
| 2565 | LISP_INLINE void | 2565 | LISP_INLINE void |
| 2566 | vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count) | 2566 | vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count) |
| 2567 | { | 2567 | { |
| 2568 | eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v)); | 2568 | eassert (offset >= 0 && count >= 0 && offset + count <= ASIZE (v)); |
| 2569 | memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args); | 2569 | memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args); |
| 2570 | } | 2570 | } |
| 2571 | 2571 | ||
diff --git a/src/lread.c b/src/lread.c index f8ab03af218..d7a16f813c8 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1571,7 +1571,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto | |||
| 1571 | { | 1571 | { |
| 1572 | struct stat st; | 1572 | struct stat st; |
| 1573 | fd = emacs_open (pfn, O_RDONLY, 0); | 1573 | fd = emacs_open (pfn, O_RDONLY, 0); |
| 1574 | if (0 <= fd | 1574 | if (fd >= 0 |
| 1575 | && (fstat (fd, &st) != 0 || S_ISDIR (st.st_mode))) | 1575 | && (fstat (fd, &st) != 0 || S_ISDIR (st.st_mode))) |
| 1576 | { | 1576 | { |
| 1577 | emacs_close (fd); | 1577 | emacs_close (fd); |
| @@ -2359,7 +2359,7 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix) | |||
| 2359 | while (c == '0'); | 2359 | while (c == '0'); |
| 2360 | } | 2360 | } |
| 2361 | 2361 | ||
| 2362 | while (-1 <= (digit = digit_to_number (c, radix))) | 2362 | while ((digit = digit_to_number (c, radix)) >= -1) |
| 2363 | { | 2363 | { |
| 2364 | if (digit == -1) | 2364 | if (digit == -1) |
| 2365 | valid = 0; | 2365 | valid = 0; |
| @@ -2731,8 +2731,8 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2731 | /* Read a non-negative integer. */ | 2731 | /* Read a non-negative integer. */ |
| 2732 | while (c >= '0' && c <= '9') | 2732 | while (c >= '0' && c <= '9') |
| 2733 | { | 2733 | { |
| 2734 | if (MOST_POSITIVE_FIXNUM / 10 < n | 2734 | if (n > MOST_POSITIVE_FIXNUM / 10 |
| 2735 | || MOST_POSITIVE_FIXNUM < n * 10 + c - '0') | 2735 | || n * 10 + c - '0' > MOST_POSITIVE_FIXNUM) |
| 2736 | n = MOST_POSITIVE_FIXNUM + 1; | 2736 | n = MOST_POSITIVE_FIXNUM + 1; |
| 2737 | else | 2737 | else |
| 2738 | n = n * 10 + c - '0'; | 2738 | n = n * 10 + c - '0'; |
| @@ -2930,7 +2930,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2930 | if (end - p < MAX_MULTIBYTE_LENGTH) | 2930 | if (end - p < MAX_MULTIBYTE_LENGTH) |
| 2931 | { | 2931 | { |
| 2932 | ptrdiff_t offset = p - read_buffer; | 2932 | ptrdiff_t offset = p - read_buffer; |
| 2933 | if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size) | 2933 | if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2) |
| 2934 | memory_full (SIZE_MAX); | 2934 | memory_full (SIZE_MAX); |
| 2935 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); | 2935 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); |
| 2936 | read_buffer_size *= 2; | 2936 | read_buffer_size *= 2; |
| @@ -3064,7 +3064,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3064 | if (end - p < MAX_MULTIBYTE_LENGTH) | 3064 | if (end - p < MAX_MULTIBYTE_LENGTH) |
| 3065 | { | 3065 | { |
| 3066 | ptrdiff_t offset = p - read_buffer; | 3066 | ptrdiff_t offset = p - read_buffer; |
| 3067 | if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size) | 3067 | if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2) |
| 3068 | memory_full (SIZE_MAX); | 3068 | memory_full (SIZE_MAX); |
| 3069 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); | 3069 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); |
| 3070 | read_buffer_size *= 2; | 3070 | read_buffer_size *= 2; |
| @@ -3094,7 +3094,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3094 | if (p == end) | 3094 | if (p == end) |
| 3095 | { | 3095 | { |
| 3096 | ptrdiff_t offset = p - read_buffer; | 3096 | ptrdiff_t offset = p - read_buffer; |
| 3097 | if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size) | 3097 | if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2) |
| 3098 | memory_full (SIZE_MAX); | 3098 | memory_full (SIZE_MAX); |
| 3099 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); | 3099 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); |
| 3100 | read_buffer_size *= 2; | 3100 | read_buffer_size *= 2; |
| @@ -3298,12 +3298,12 @@ string_to_number (char const *string, int base, bool ignore_trailing) | |||
| 3298 | state = 0; | 3298 | state = 0; |
| 3299 | 3299 | ||
| 3300 | leading_digit = digit_to_number (*cp, base); | 3300 | leading_digit = digit_to_number (*cp, base); |
| 3301 | if (0 <= leading_digit) | 3301 | if (leading_digit >= 0) |
| 3302 | { | 3302 | { |
| 3303 | state |= LEAD_INT; | 3303 | state |= LEAD_INT; |
| 3304 | do | 3304 | do |
| 3305 | ++cp; | 3305 | ++cp; |
| 3306 | while (0 <= digit_to_number (*cp, base)); | 3306 | while (digit_to_number (*cp, base) >= 0); |
| 3307 | } | 3307 | } |
| 3308 | if (*cp == '.') | 3308 | if (*cp == '.') |
| 3309 | { | 3309 | { |
| @@ -3380,7 +3380,7 @@ string_to_number (char const *string, int base, bool ignore_trailing) | |||
| 3380 | 3380 | ||
| 3381 | /* If the number uses integer and not float syntax, and is in C-language | 3381 | /* If the number uses integer and not float syntax, and is in C-language |
| 3382 | range, use its value, preferably as a fixnum. */ | 3382 | range, use its value, preferably as a fixnum. */ |
| 3383 | if (0 <= leading_digit && ! float_syntax) | 3383 | if (leading_digit >= 0 && ! float_syntax) |
| 3384 | { | 3384 | { |
| 3385 | uintmax_t n; | 3385 | uintmax_t n; |
| 3386 | 3386 | ||
diff --git a/src/menu.c b/src/menu.c index fdef54dd657..ffb5c3bc936 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -173,7 +173,7 @@ static void | |||
| 173 | ensure_menu_items (int items) | 173 | ensure_menu_items (int items) |
| 174 | { | 174 | { |
| 175 | int incr = items - (menu_items_allocated - menu_items_used); | 175 | int incr = items - (menu_items_allocated - menu_items_used); |
| 176 | if (0 < incr) | 176 | if (incr > 0) |
| 177 | { | 177 | { |
| 178 | menu_items = larger_vector (menu_items, incr, INT_MAX); | 178 | menu_items = larger_vector (menu_items, incr, INT_MAX); |
| 179 | menu_items_allocated = ASIZE (menu_items); | 179 | menu_items_allocated = ASIZE (menu_items); |
diff --git a/src/minibuf.c b/src/minibuf.c index 25425cb97dc..56459353714 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -251,7 +251,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, | |||
| 251 | { | 251 | { |
| 252 | if (len == size) | 252 | if (len == size) |
| 253 | { | 253 | { |
| 254 | if (STRING_BYTES_BOUND / 2 < size) | 254 | if (size > STRING_BYTES_BOUND / 2) |
| 255 | memory_full (SIZE_MAX); | 255 | memory_full (SIZE_MAX); |
| 256 | size *= 2; | 256 | size *= 2; |
| 257 | line = xrealloc (line, size); | 257 | line = xrealloc (line, size); |
diff --git a/src/print.c b/src/print.c index 4ab80fe1605..ce10d6295e6 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -227,9 +227,9 @@ printchar (unsigned int ch, Lisp_Object fun) | |||
| 227 | if (NILP (fun)) | 227 | if (NILP (fun)) |
| 228 | { | 228 | { |
| 229 | ptrdiff_t incr = len - (print_buffer_size - print_buffer_pos_byte); | 229 | ptrdiff_t incr = len - (print_buffer_size - print_buffer_pos_byte); |
| 230 | if (0 < incr) | 230 | if (incr > 0) |
| 231 | print_buffer = | 231 | print_buffer = xpalloc (print_buffer, &print_buffer_size, |
| 232 | xpalloc (print_buffer, &print_buffer_size, incr, -1, 1); | 232 | incr, -1, 1); |
| 233 | memcpy (print_buffer + print_buffer_pos_byte, str, len); | 233 | memcpy (print_buffer + print_buffer_pos_byte, str, len); |
| 234 | print_buffer_pos += 1; | 234 | print_buffer_pos += 1; |
| 235 | print_buffer_pos_byte += len; | 235 | print_buffer_pos_byte += len; |
| @@ -273,7 +273,7 @@ strout (const char *ptr, ptrdiff_t size, ptrdiff_t size_byte, | |||
| 273 | if (NILP (printcharfun)) | 273 | if (NILP (printcharfun)) |
| 274 | { | 274 | { |
| 275 | ptrdiff_t incr = size_byte - (print_buffer_size - print_buffer_pos_byte); | 275 | ptrdiff_t incr = size_byte - (print_buffer_size - print_buffer_pos_byte); |
| 276 | if (0 < incr) | 276 | if (incr > 0) |
| 277 | print_buffer = xpalloc (print_buffer, &print_buffer_size, incr, -1, 1); | 277 | print_buffer = xpalloc (print_buffer, &print_buffer_size, incr, -1, 1); |
| 278 | memcpy (print_buffer + print_buffer_pos_byte, ptr, size_byte); | 278 | memcpy (print_buffer + print_buffer_pos_byte, ptr, size_byte); |
| 279 | print_buffer_pos += size; | 279 | print_buffer_pos += size; |
diff --git a/src/process.c b/src/process.c index ed71ff76e6a..6a14a536707 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -136,7 +136,7 @@ extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, | |||
| 136 | /* Work around GCC 4.7.0 bug with strict overflow checking; see | 136 | /* Work around GCC 4.7.0 bug with strict overflow checking; see |
| 137 | <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>. | 137 | <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>. |
| 138 | These lines can be removed once the GCC bug is fixed. */ | 138 | These lines can be removed once the GCC bug is fixed. */ |
| 139 | #if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ | 139 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) |
| 140 | # pragma GCC diagnostic ignored "-Wstrict-overflow" | 140 | # pragma GCC diagnostic ignored "-Wstrict-overflow" |
| 141 | #endif | 141 | #endif |
| 142 | 142 | ||
| @@ -1804,7 +1804,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1804 | /* Back in the parent process. */ | 1804 | /* Back in the parent process. */ |
| 1805 | 1805 | ||
| 1806 | XPROCESS (process)->pid = pid; | 1806 | XPROCESS (process)->pid = pid; |
| 1807 | if (0 <= pid) | 1807 | if (pid >= 0) |
| 1808 | XPROCESS (process)->alive = 1; | 1808 | XPROCESS (process)->alive = 1; |
| 1809 | 1809 | ||
| 1810 | /* Stop blocking signals in the parent. */ | 1810 | /* Stop blocking signals in the parent. */ |
| @@ -3901,7 +3901,7 @@ Return non-nil if we received any output before the timeout expired. */) | |||
| 3901 | { | 3901 | { |
| 3902 | if (INTEGERP (seconds)) | 3902 | if (INTEGERP (seconds)) |
| 3903 | { | 3903 | { |
| 3904 | if (0 < XINT (seconds)) | 3904 | if (XINT (seconds) > 0) |
| 3905 | { | 3905 | { |
| 3906 | secs = XINT (seconds); | 3906 | secs = XINT (seconds); |
| 3907 | nsecs = 0; | 3907 | nsecs = 0; |
| @@ -3909,7 +3909,7 @@ Return non-nil if we received any output before the timeout expired. */) | |||
| 3909 | } | 3909 | } |
| 3910 | else if (FLOATP (seconds)) | 3910 | else if (FLOATP (seconds)) |
| 3911 | { | 3911 | { |
| 3912 | if (0 < XFLOAT_DATA (seconds)) | 3912 | if (XFLOAT_DATA (seconds) > 0) |
| 3913 | { | 3913 | { |
| 3914 | EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (XFLOAT_DATA (seconds)); | 3914 | EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (XFLOAT_DATA (seconds)); |
| 3915 | secs = min (EMACS_SECS (t), WAIT_READING_MAX); | 3915 | secs = min (EMACS_SECS (t), WAIT_READING_MAX); |
| @@ -4236,12 +4236,12 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4236 | time_limit = 0; | 4236 | time_limit = 0; |
| 4237 | nsecs = -1; | 4237 | nsecs = -1; |
| 4238 | } | 4238 | } |
| 4239 | else if (TYPE_MAXIMUM (time_t) < time_limit) | 4239 | else if (time_limit > TYPE_MAXIMUM (time_t)) |
| 4240 | time_limit = TYPE_MAXIMUM (time_t); | 4240 | time_limit = TYPE_MAXIMUM (time_t); |
| 4241 | 4241 | ||
| 4242 | /* Since we may need to wait several times, | 4242 | /* Since we may need to wait several times, |
| 4243 | compute the absolute time to return at. */ | 4243 | compute the absolute time to return at. */ |
| 4244 | if (time_limit || 0 < nsecs) | 4244 | if (time_limit || nsecs > 0) |
| 4245 | { | 4245 | { |
| 4246 | timeout = make_emacs_time (time_limit, nsecs); | 4246 | timeout = make_emacs_time (time_limit, nsecs); |
| 4247 | end_time = add_emacs_time (current_emacs_time (), timeout); | 4247 | end_time = add_emacs_time (current_emacs_time (), timeout); |
| @@ -4273,7 +4273,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4273 | 4273 | ||
| 4274 | timeout = make_emacs_time (0, 0); | 4274 | timeout = make_emacs_time (0, 0); |
| 4275 | } | 4275 | } |
| 4276 | else if (time_limit || 0 < nsecs) | 4276 | else if (time_limit || nsecs > 0) |
| 4277 | { | 4277 | { |
| 4278 | EMACS_TIME now = current_emacs_time (); | 4278 | EMACS_TIME now = current_emacs_time (); |
| 4279 | if (EMACS_TIME_LE (end_time, now)) | 4279 | if (EMACS_TIME_LE (end_time, now)) |
| @@ -4325,7 +4325,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4325 | break; | 4325 | break; |
| 4326 | 4326 | ||
| 4327 | /* A negative timeout means do not wait at all. */ | 4327 | /* A negative timeout means do not wait at all. */ |
| 4328 | if (0 <= nsecs) | 4328 | if (nsecs >= 0) |
| 4329 | { | 4329 | { |
| 4330 | if (EMACS_TIME_VALID_P (timer_delay)) | 4330 | if (EMACS_TIME_VALID_P (timer_delay)) |
| 4331 | { | 4331 | { |
| @@ -4407,7 +4407,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4407 | if (nread == 0) | 4407 | if (nread == 0) |
| 4408 | break; | 4408 | break; |
| 4409 | 4409 | ||
| 4410 | if (0 < nread) | 4410 | if (nread > 0) |
| 4411 | { | 4411 | { |
| 4412 | total_nread += nread; | 4412 | total_nread += nread; |
| 4413 | got_some_input = 1; | 4413 | got_some_input = 1; |
| @@ -4948,7 +4948,7 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 4948 | else | 4948 | else |
| 4949 | #endif | 4949 | #endif |
| 4950 | { | 4950 | { |
| 4951 | bool buffered = 0 <= proc_buffered_char[channel]; | 4951 | bool buffered = proc_buffered_char[channel] >= 0; |
| 4952 | if (buffered) | 4952 | if (buffered) |
| 4953 | { | 4953 | { |
| 4954 | chars[carryover] = proc_buffered_char[channel]; | 4954 | chars[carryover] = proc_buffered_char[channel]; |
| @@ -5455,7 +5455,7 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len, | |||
| 5455 | rv = sendto (outfd, cur_buf, cur_len, | 5455 | rv = sendto (outfd, cur_buf, cur_len, |
| 5456 | 0, datagram_address[outfd].sa, | 5456 | 0, datagram_address[outfd].sa, |
| 5457 | datagram_address[outfd].len); | 5457 | datagram_address[outfd].len); |
| 5458 | if (0 <= rv) | 5458 | if (rv >= 0) |
| 5459 | written = rv; | 5459 | written = rv; |
| 5460 | else if (errno == EMSGSIZE) | 5460 | else if (errno == EMSGSIZE) |
| 5461 | report_file_error ("sending datagram", Fcons (proc, Qnil)); | 5461 | report_file_error ("sending datagram", Fcons (proc, Qnil)); |
| @@ -6578,7 +6578,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 6578 | time_limit = TYPE_MAXIMUM (time_t); | 6578 | time_limit = TYPE_MAXIMUM (time_t); |
| 6579 | 6579 | ||
| 6580 | /* What does time_limit really mean? */ | 6580 | /* What does time_limit really mean? */ |
| 6581 | if (time_limit || 0 < nsecs) | 6581 | if (time_limit || nsecs > 0) |
| 6582 | { | 6582 | { |
| 6583 | timeout = make_emacs_time (time_limit, nsecs); | 6583 | timeout = make_emacs_time (time_limit, nsecs); |
| 6584 | end_time = add_emacs_time (current_emacs_time (), timeout); | 6584 | end_time = add_emacs_time (current_emacs_time (), timeout); |
| @@ -6616,7 +6616,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 6616 | 6616 | ||
| 6617 | timeout = make_emacs_time (0, 0); | 6617 | timeout = make_emacs_time (0, 0); |
| 6618 | } | 6618 | } |
| 6619 | else if (time_limit || 0 < nsecs) | 6619 | else if (time_limit || nsecs > 0) |
| 6620 | { | 6620 | { |
| 6621 | EMACS_TIME now = current_emacs_time (); | 6621 | EMACS_TIME now = current_emacs_time (); |
| 6622 | if (EMACS_TIME_LE (end_time, now)) | 6622 | if (EMACS_TIME_LE (end_time, now)) |
| @@ -6654,7 +6654,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 6654 | && requeued_events_pending_p ()) | 6654 | && requeued_events_pending_p ()) |
| 6655 | break; | 6655 | break; |
| 6656 | 6656 | ||
| 6657 | if (EMACS_TIME_VALID_P (timer_delay) && 0 <= nsecs) | 6657 | if (EMACS_TIME_VALID_P (timer_delay) && nsecs >= 0) |
| 6658 | { | 6658 | { |
| 6659 | if (EMACS_TIME_LT (timer_delay, timeout)) | 6659 | if (EMACS_TIME_LT (timer_delay, timeout)) |
| 6660 | { | 6660 | { |
diff --git a/src/profiler.c b/src/profiler.c index 85d9c1ca88a..0a0a4d0bc57 100644 --- a/src/profiler.c +++ b/src/profiler.c | |||
| @@ -55,7 +55,7 @@ make_log (int heap_size, int max_stack_depth) | |||
| 55 | /* What is special about our hash-tables is that the keys are pre-filled | 55 | /* What is special about our hash-tables is that the keys are pre-filled |
| 56 | with the vectors we'll put in them. */ | 56 | with the vectors we'll put in them. */ |
| 57 | int i = ASIZE (h->key_and_value) / 2; | 57 | int i = ASIZE (h->key_and_value) / 2; |
| 58 | while (0 < i) | 58 | while (i > 0) |
| 59 | set_hash_key_slot (h, --i, | 59 | set_hash_key_slot (h, --i, |
| 60 | Fmake_vector (make_number (max_stack_depth), Qnil)); | 60 | Fmake_vector (make_number (max_stack_depth), Qnil)); |
| 61 | return log; | 61 | return log; |
| @@ -247,7 +247,7 @@ handle_profiler_signal (int signal) | |||
| 247 | if (profiler_timer_ok) | 247 | if (profiler_timer_ok) |
| 248 | { | 248 | { |
| 249 | int overruns = timer_getoverrun (profiler_timer); | 249 | int overruns = timer_getoverrun (profiler_timer); |
| 250 | eassert (0 <= overruns); | 250 | eassert (overruns >= 0); |
| 251 | count += overruns; | 251 | count += overruns; |
| 252 | } | 252 | } |
| 253 | #endif | 253 | #endif |
diff --git a/src/regex.c b/src/regex.c index 051a4fdc26b..648f2529649 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | 33 | ||
| 34 | /* Ignore some GCC warnings for now. This section should go away | 34 | /* Ignore some GCC warnings for now. This section should go away |
| 35 | once the Emacs and Gnulib regex code is merged. */ | 35 | once the Emacs and Gnulib regex code is merged. */ |
| 36 | #if (__GNUC__ == 4 && 5 <= __GNUC_MINOR__) || 4 < __GNUC__ | 36 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) |
| 37 | # pragma GCC diagnostic ignored "-Wstrict-overflow" | 37 | # pragma GCC diagnostic ignored "-Wstrict-overflow" |
| 38 | # ifndef emacs | 38 | # ifndef emacs |
| 39 | # pragma GCC diagnostic ignored "-Wunused-but-set-variable" | 39 | # pragma GCC diagnostic ignored "-Wunused-but-set-variable" |
| @@ -6404,8 +6404,8 @@ weak_function | |||
| 6404 | re_exec (const char *s) | 6404 | re_exec (const char *s) |
| 6405 | { | 6405 | { |
| 6406 | const size_t len = strlen (s); | 6406 | const size_t len = strlen (s); |
| 6407 | return | 6407 | return (re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0) |
| 6408 | 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0); | 6408 | >= 0); |
| 6409 | } | 6409 | } |
| 6410 | #endif /* _REGEX_RE_COMP */ | 6410 | #endif /* _REGEX_RE_COMP */ |
| 6411 | 6411 | ||
diff --git a/src/regex.h b/src/regex.h index f1fd837bd6f..8fe7ba16adc 100644 --- a/src/regex.h +++ b/src/regex.h | |||
| @@ -530,7 +530,7 @@ extern int re_exec (const char *); | |||
| 530 | /* GCC 2.95 and later have "__restrict"; C99 compilers have | 530 | /* GCC 2.95 and later have "__restrict"; C99 compilers have |
| 531 | "restrict", and "configure" may have defined "restrict". */ | 531 | "restrict", and "configure" may have defined "restrict". */ |
| 532 | #ifndef __restrict | 532 | #ifndef __restrict |
| 533 | # if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) | 533 | # if ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) |
| 534 | # if defined restrict || 199901L <= __STDC_VERSION__ | 534 | # if defined restrict || 199901L <= __STDC_VERSION__ |
| 535 | # define __restrict restrict | 535 | # define __restrict restrict |
| 536 | # else | 536 | # else |
diff --git a/src/search.c b/src/search.c index c5ac7d494dc..ece346ecd06 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -326,7 +326,7 @@ looking_at_1 (Lisp_Object string, bool posix) | |||
| 326 | if (i == -2) | 326 | if (i == -2) |
| 327 | matcher_overflow (); | 327 | matcher_overflow (); |
| 328 | 328 | ||
| 329 | val = (0 <= i ? Qt : Qnil); | 329 | val = (i >= 0 ? Qt : Qnil); |
| 330 | if (NILP (Vinhibit_changing_match_data) && i >= 0) | 330 | if (NILP (Vinhibit_changing_match_data) && i >= 0) |
| 331 | for (i = 0; i < search_regs.num_regs; i++) | 331 | for (i = 0; i < search_regs.num_regs; i++) |
| 332 | if (search_regs.start[i] >= 0) | 332 | if (search_regs.start[i] >= 0) |
| @@ -2450,7 +2450,7 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2450 | else if (c >= '1' && c <= '9') | 2450 | else if (c >= '1' && c <= '9') |
| 2451 | { | 2451 | { |
| 2452 | if (c - '0' < search_regs.num_regs | 2452 | if (c - '0' < search_regs.num_regs |
| 2453 | && 0 <= search_regs.start[c - '0']) | 2453 | && search_regs.start[c - '0'] >= 0) |
| 2454 | { | 2454 | { |
| 2455 | substart = search_regs.start[c - '0']; | 2455 | substart = search_regs.start[c - '0']; |
| 2456 | subend = search_regs.end[c - '0']; | 2456 | subend = search_regs.end[c - '0']; |
| @@ -2533,7 +2533,7 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2533 | bool str_multibyte = STRING_MULTIBYTE (newtext); | 2533 | bool str_multibyte = STRING_MULTIBYTE (newtext); |
| 2534 | bool really_changed = 0; | 2534 | bool really_changed = 0; |
| 2535 | 2535 | ||
| 2536 | substed_alloc_size = ((STRING_BYTES_BOUND - 100) / 2 < length | 2536 | substed_alloc_size = (length > (STRING_BYTES_BOUND - 100) / 2 |
| 2537 | ? STRING_BYTES_BOUND | 2537 | ? STRING_BYTES_BOUND |
| 2538 | : length * 2 + 100); | 2538 | : length * 2 + 100); |
| 2539 | substed = xmalloc (substed_alloc_size); | 2539 | substed = xmalloc (substed_alloc_size); |
diff --git a/src/sysdep.c b/src/sysdep.c index bff11fc9f75..1d3e646d359 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -282,7 +282,7 @@ get_child_status (pid_t child, int *status, int options, bool interruptible) | |||
| 282 | reap an unwanted process by mistake. For example, invoking | 282 | reap an unwanted process by mistake. For example, invoking |
| 283 | waitpid (-1, ...) can mess up glib by reaping glib's subprocesses, | 283 | waitpid (-1, ...) can mess up glib by reaping glib's subprocesses, |
| 284 | so that another thread running glib won't find them. */ | 284 | so that another thread running glib won't find them. */ |
| 285 | eassert (0 < child); | 285 | eassert (child > 0); |
| 286 | 286 | ||
| 287 | while ((pid = waitpid (child, status, options)) < 0) | 287 | while ((pid = waitpid (child, status, options)) < 0) |
| 288 | { | 288 | { |
| @@ -2691,7 +2691,7 @@ procfs_ttyname (int rdev) | |||
| 2691 | 2691 | ||
| 2692 | while (!feof (fdev) && !ferror (fdev)) | 2692 | while (!feof (fdev) && !ferror (fdev)) |
| 2693 | { | 2693 | { |
| 2694 | if (3 <= fscanf (fdev, "%*s %s %u %s %*s\n", name, &major, minor) | 2694 | if (fscanf (fdev, "%*s %s %u %s %*s\n", name, &major, minor) >= 3 |
| 2695 | && major == MAJOR (rdev)) | 2695 | && major == MAJOR (rdev)) |
| 2696 | { | 2696 | { |
| 2697 | minor_beg = strtoul (minor, &endp, 0); | 2697 | minor_beg = strtoul (minor, &endp, 0); |
| @@ -2731,7 +2731,7 @@ procfs_get_total_memory (void) | |||
| 2731 | 2731 | ||
| 2732 | while (!feof (fmem) && !ferror (fmem)) | 2732 | while (!feof (fmem) && !ferror (fmem)) |
| 2733 | { | 2733 | { |
| 2734 | if (2 <= fscanf (fmem, "%s %lu kB\n", entry_name, &entry_value) | 2734 | if (fscanf (fmem, "%s %lu kB\n", entry_name, &entry_value) >= 2 |
| 2735 | && strcmp (entry_name, "MemTotal:") == 0) | 2735 | && strcmp (entry_name, "MemTotal:") == 0) |
| 2736 | { | 2736 | { |
| 2737 | retval = entry_value; | 2737 | retval = entry_value; |
diff --git a/src/systime.h b/src/systime.h index fa5e7270cb5..da495b9064b 100644 --- a/src/systime.h +++ b/src/systime.h | |||
| @@ -121,7 +121,7 @@ EMACS_TIME_SIGN (EMACS_TIME t) | |||
| 121 | SYSTIME_INLINE int | 121 | SYSTIME_INLINE int |
| 122 | EMACS_TIME_VALID_P (EMACS_TIME t) | 122 | EMACS_TIME_VALID_P (EMACS_TIME t) |
| 123 | { | 123 | { |
| 124 | return 0 <= t.tv_nsec; | 124 | return t.tv_nsec >= 0; |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | /* Convert the double D to the greatest EMACS_TIME not greater than D. | 127 | /* Convert the double D to the greatest EMACS_TIME not greater than D. |
diff --git a/src/term.c b/src/term.c index 38706602a02..28b944c6436 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2909,7 +2909,7 @@ dissociate_if_controlling_tty (int fd) | |||
| 2909 | { | 2909 | { |
| 2910 | /* If tcgetpgrp succeeds, fd is the controlling terminal, | 2910 | /* If tcgetpgrp succeeds, fd is the controlling terminal, |
| 2911 | so dissociate it by invoking setsid. */ | 2911 | so dissociate it by invoking setsid. */ |
| 2912 | if (0 <= tcgetpgrp (fd) && setsid () < 0) | 2912 | if (tcgetpgrp (fd) >= 0 && setsid () < 0) |
| 2913 | { | 2913 | { |
| 2914 | #ifdef TIOCNOTTY | 2914 | #ifdef TIOCNOTTY |
| 2915 | /* setsid failed, presumably because Emacs is already a process | 2915 | /* setsid failed, presumably because Emacs is already a process |
diff --git a/src/window.c b/src/window.c index 875d7770277..1784b38ba6d 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -6002,8 +6002,7 @@ get_phys_cursor_glyph (struct window *w) | |||
| 6002 | hpos = row->used[TEXT_AREA] - 1; | 6002 | hpos = row->used[TEXT_AREA] - 1; |
| 6003 | } | 6003 | } |
| 6004 | 6004 | ||
| 6005 | if (row->used[TEXT_AREA] > hpos | 6005 | if (hpos >= 0 && hpos < row->used[TEXT_AREA]) |
| 6006 | && 0 <= hpos) | ||
| 6007 | glyph = row->glyphs[TEXT_AREA] + hpos; | 6006 | glyph = row->glyphs[TEXT_AREA] + hpos; |
| 6008 | else | 6007 | else |
| 6009 | glyph = NULL; | 6008 | glyph = NULL; |
diff --git a/src/xdisp.c b/src/xdisp.c index 25b143d362a..d42e53fc314 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2677,7 +2677,7 @@ init_iterator (struct it *it, struct window *w, | |||
| 2677 | and IT->region_end_charpos to the start and end of a visible region | 2677 | and IT->region_end_charpos to the start and end of a visible region |
| 2678 | in window IT->w. Set both to -1 to indicate no region. */ | 2678 | in window IT->w. Set both to -1 to indicate no region. */ |
| 2679 | markpos = markpos_of_region (); | 2679 | markpos = markpos_of_region (); |
| 2680 | if (0 <= markpos | 2680 | if (markpos >= 0 |
| 2681 | /* Maybe highlight only in selected window. */ | 2681 | /* Maybe highlight only in selected window. */ |
| 2682 | && (/* Either show region everywhere. */ | 2682 | && (/* Either show region everywhere. */ |
| 2683 | highlight_nonselected_windows | 2683 | highlight_nonselected_windows |
| @@ -13170,8 +13170,8 @@ redisplay_internal (void) | |||
| 13170 | PT == w->last_point | 13170 | PT == w->last_point |
| 13171 | /* Make sure the cursor was last displayed | 13171 | /* Make sure the cursor was last displayed |
| 13172 | in this window. Otherwise we have to reposition it. */ | 13172 | in this window. Otherwise we have to reposition it. */ |
| 13173 | && 0 <= w->cursor.vpos | 13173 | && w->cursor.vpos >= 0 |
| 13174 | && WINDOW_TOTAL_LINES (w) > w->cursor.vpos) | 13174 | && w->cursor.vpos < WINDOW_TOTAL_LINES (w)) |
| 13175 | { | 13175 | { |
| 13176 | if (!must_finish) | 13176 | if (!must_finish) |
| 13177 | { | 13177 | { |
| @@ -15520,7 +15520,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 15520 | 15520 | ||
| 15521 | /* If we are highlighting the region, then we just changed | 15521 | /* If we are highlighting the region, then we just changed |
| 15522 | the region, so redisplay to show it. */ | 15522 | the region, so redisplay to show it. */ |
| 15523 | if (0 <= markpos_of_region ()) | 15523 | if (markpos_of_region () >= 0) |
| 15524 | { | 15524 | { |
| 15525 | clear_glyph_matrix (w->desired_matrix); | 15525 | clear_glyph_matrix (w->desired_matrix); |
| 15526 | if (!try_window (window, startp, 0)) | 15526 | if (!try_window (window, startp, 0)) |
| @@ -16221,7 +16221,7 @@ try_window_reusing_current_matrix (struct window *w) | |||
| 16221 | return 0; | 16221 | return 0; |
| 16222 | 16222 | ||
| 16223 | /* Can't do this if region may have changed. */ | 16223 | /* Can't do this if region may have changed. */ |
| 16224 | if (0 <= markpos_of_region () | 16224 | if (markpos_of_region () >= 0 |
| 16225 | || w->region_showing | 16225 | || w->region_showing |
| 16226 | || !NILP (Vshow_trailing_whitespace)) | 16226 | || !NILP (Vshow_trailing_whitespace)) |
| 16227 | return 0; | 16227 | return 0; |
| @@ -17053,7 +17053,7 @@ try_window_id (struct window *w) | |||
| 17053 | 17053 | ||
| 17054 | /* Can't use this if highlighting a region because a cursor movement | 17054 | /* Can't use this if highlighting a region because a cursor movement |
| 17055 | will do more than just set the cursor. */ | 17055 | will do more than just set the cursor. */ |
| 17056 | if (0 <= markpos_of_region ()) | 17056 | if (markpos_of_region () >= 0) |
| 17057 | GIVE_UP (9); | 17057 | GIVE_UP (9); |
| 17058 | 17058 | ||
| 17059 | /* Likewise if highlighting trailing whitespace. */ | 17059 | /* Likewise if highlighting trailing whitespace. */ |
| @@ -21008,7 +21008,7 @@ pint2hrstr (char *buf, int width, ptrdiff_t d) | |||
| 21008 | char * psuffix; | 21008 | char * psuffix; |
| 21009 | char * p; | 21009 | char * p; |
| 21010 | 21010 | ||
| 21011 | if (1000 <= quotient) | 21011 | if (quotient >= 1000) |
| 21012 | { | 21012 | { |
| 21013 | /* Scale to the appropriate EXPONENT. */ | 21013 | /* Scale to the appropriate EXPONENT. */ |
| 21014 | do | 21014 | do |
| @@ -21017,13 +21017,13 @@ pint2hrstr (char *buf, int width, ptrdiff_t d) | |||
| 21017 | quotient /= 1000; | 21017 | quotient /= 1000; |
| 21018 | exponent++; | 21018 | exponent++; |
| 21019 | } | 21019 | } |
| 21020 | while (1000 <= quotient); | 21020 | while (quotient >= 1000); |
| 21021 | 21021 | ||
| 21022 | /* Round to nearest and decide whether to use TENTHS or not. */ | 21022 | /* Round to nearest and decide whether to use TENTHS or not. */ |
| 21023 | if (quotient <= 9) | 21023 | if (quotient <= 9) |
| 21024 | { | 21024 | { |
| 21025 | tenths = remainder / 100; | 21025 | tenths = remainder / 100; |
| 21026 | if (50 <= remainder % 100) | 21026 | if (remainder % 100 >= 50) |
| 21027 | { | 21027 | { |
| 21028 | if (tenths < 9) | 21028 | if (tenths < 9) |
| 21029 | tenths++; | 21029 | tenths++; |
| @@ -21038,7 +21038,7 @@ pint2hrstr (char *buf, int width, ptrdiff_t d) | |||
| 21038 | } | 21038 | } |
| 21039 | } | 21039 | } |
| 21040 | else | 21040 | else |
| 21041 | if (500 <= remainder) | 21041 | if (remainder >= 500) |
| 21042 | { | 21042 | { |
| 21043 | if (quotient < 999) | 21043 | if (quotient < 999) |
| 21044 | quotient++; | 21044 | quotient++; |
diff --git a/src/xfns.c b/src/xfns.c index 488365561d3..a6a179be97d 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -4322,7 +4322,7 @@ no value of TYPE (always string in the MS Windows case). */) | |||
| 4322 | property and those are indeed in 32 bit quantities if format is | 4322 | property and those are indeed in 32 bit quantities if format is |
| 4323 | 32. */ | 4323 | 32. */ |
| 4324 | 4324 | ||
| 4325 | if (32 < BITS_PER_LONG && actual_format == 32) | 4325 | if (BITS_PER_LONG > 32 && actual_format == 32) |
| 4326 | { | 4326 | { |
| 4327 | unsigned long i; | 4327 | unsigned long i; |
| 4328 | int *idata = (int *) tmp_data; | 4328 | int *idata = (int *) tmp_data; |
diff --git a/src/xmenu.c b/src/xmenu.c index 57cf27f955d..af08eeb657c 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -1055,7 +1055,7 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p) | |||
| 1055 | wv->help = Qnil; | 1055 | wv->help = Qnil; |
| 1056 | first_wv = wv; | 1056 | first_wv = wv; |
| 1057 | 1057 | ||
| 1058 | for (i = 0; 0 <= submenu_start[i]; i++) | 1058 | for (i = 0; submenu_start[i] >= 0; i++) |
| 1059 | { | 1059 | { |
| 1060 | menu_items_n_panes = submenu_n_panes[i]; | 1060 | menu_items_n_panes = submenu_n_panes[i]; |
| 1061 | wv = digest_single_submenu (submenu_start[i], submenu_end[i], | 1061 | wv = digest_single_submenu (submenu_start[i], submenu_end[i], |
diff --git a/src/xselect.c b/src/xselect.c index e9a8e2107db..cca1a47212b 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -1388,7 +1388,7 @@ x_get_window_property (Display *display, Window window, Atom property, | |||
| 1388 | data = data1; | 1388 | data = data1; |
| 1389 | } | 1389 | } |
| 1390 | 1390 | ||
| 1391 | if (32 < BITS_PER_LONG && *actual_format_ret == 32) | 1391 | if (BITS_PER_LONG > 32 && *actual_format_ret == 32) |
| 1392 | { | 1392 | { |
| 1393 | unsigned long i; | 1393 | unsigned long i; |
| 1394 | int *idata = (int *) (data + offset); | 1394 | int *idata = (int *) (data + offset); |
| @@ -2541,7 +2541,7 @@ x_handle_dnd_message (struct frame *f, XClientMessageEvent *event, | |||
| 2541 | function expects them to be of size int (i.e. 32). So to be able to | 2541 | function expects them to be of size int (i.e. 32). So to be able to |
| 2542 | use that function, put the data in the form it expects if format is 32. */ | 2542 | use that function, put the data in the form it expects if format is 32. */ |
| 2543 | 2543 | ||
| 2544 | if (32 < BITS_PER_LONG && event->format == 32) | 2544 | if (BITS_PER_LONG > 32 && event->format == 32) |
| 2545 | { | 2545 | { |
| 2546 | for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */ | 2546 | for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */ |
| 2547 | idata[i] = event->data.l[i]; | 2547 | idata[i] = event->data.l[i]; |
diff --git a/src/xsmfns.c b/src/xsmfns.c index cb7122202df..0af196d2160 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c | |||
| @@ -221,7 +221,7 @@ smc_save_yourself_CB (SmcConn smcConn, | |||
| 221 | props[props_idx]->name = xstrdup (SmRestartCommand); | 221 | props[props_idx]->name = xstrdup (SmRestartCommand); |
| 222 | props[props_idx]->type = xstrdup (SmLISTofARRAY8); | 222 | props[props_idx]->type = xstrdup (SmLISTofARRAY8); |
| 223 | /* /path/to/emacs, --smid=xxx --no-splash --chdir=dir ... */ | 223 | /* /path/to/emacs, --smid=xxx --no-splash --chdir=dir ... */ |
| 224 | if (INT_MAX - 3 < initial_argc) | 224 | if (initial_argc > INT_MAX - 3) |
| 225 | memory_full (SIZE_MAX); | 225 | memory_full (SIZE_MAX); |
| 226 | i = 3 + initial_argc; | 226 | i = 3 + initial_argc; |
| 227 | props[props_idx]->num_vals = i; | 227 | props[props_idx]->num_vals = i; |
diff --git a/src/xterm.c b/src/xterm.c index 88433b6c0b3..d8c2dfdda82 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -5076,7 +5076,7 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int rebuild | |||
| 5076 | 5076 | ||
| 5077 | /* Draw the empty space above the handle. Note that we can't clear | 5077 | /* Draw the empty space above the handle. Note that we can't clear |
| 5078 | zero-height areas; that means "clear to end of window." */ | 5078 | zero-height areas; that means "clear to end of window." */ |
| 5079 | if (0 < start) | 5079 | if (start > 0) |
| 5080 | x_clear_area (FRAME_X_DISPLAY (f), w, | 5080 | x_clear_area (FRAME_X_DISPLAY (f), w, |
| 5081 | /* x, y, width, height, and exposures. */ | 5081 | /* x, y, width, height, and exposures. */ |
| 5082 | VERTICAL_SCROLL_BAR_LEFT_BORDER, | 5082 | VERTICAL_SCROLL_BAR_LEFT_BORDER, |