diff options
| author | Stefan Monnier | 2012-10-01 20:31:56 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-10-01 20:31:56 -0400 |
| commit | 090cf9dbb07e7ab0817c208b6d8dcd613180b7c3 (patch) | |
| tree | 7057ce7dfff1066256c5a321e3ffd5c8a79c7eb4 | |
| parent | 9f7b98f812674d2824d713b460973842e6e0943b (diff) | |
| download | emacs-090cf9dbb07e7ab0817c208b6d8dcd613180b7c3.tar.gz emacs-090cf9dbb07e7ab0817c208b6d8dcd613180b7c3.zip | |
Misc minor simplifications in C code.
* src/buffer.c (Fset_buffer_multibyte): Signal an error instead of widening.
(Fmake_overlay): Remove redundant tests.
* src/coding.h (ENCODE_FILE, DECODE_FILE, DECODE_SYSTEM): Remove special
case for the special 0 coding-system.
* src/frame.c (Fmake_terminal_frame): Prefer safer CONSP over !NILP.
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/buffer.c | 13 | ||||
| -rw-r--r-- | src/coding.h | 6 | ||||
| -rw-r--r-- | src/frame.c | 2 |
5 files changed, 19 insertions, 14 deletions
| @@ -619,6 +619,8 @@ inefficiency, and not namespace-clean. | |||
| 619 | 619 | ||
| 620 | * Incompatible Lisp Changes in Emacs 24.3 | 620 | * Incompatible Lisp Changes in Emacs 24.3 |
| 621 | 621 | ||
| 622 | ** set-buffer-multibyte now signals an error in narrowed buffers. | ||
| 623 | |||
| 622 | +++ | 624 | +++ |
| 623 | ** (random) by default now returns a different random sequence in | 625 | ** (random) by default now returns a different random sequence in |
| 624 | every Emacs run. Use (random S), where S is a string, to set the | 626 | every Emacs run. Use (random S), where S is a string, to set the |
diff --git a/src/ChangeLog b/src/ChangeLog index 56e75b5efce..507fe80c8ab 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2012-10-02 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * frame.c (Fmake_terminal_frame): Prefer safer CONSP over !NILP. | ||
| 4 | |||
| 5 | * coding.h (ENCODE_FILE, DECODE_FILE, DECODE_SYSTEM): Remove special | ||
| 6 | case for the special 0 coding-system. | ||
| 7 | |||
| 8 | * buffer.c (Fset_buffer_multibyte): Signal an error instead of widening. | ||
| 9 | (Fmake_overlay): Remove redundant tests. | ||
| 10 | |||
| 1 | 2012-10-02 Juanma Barranquero <lekktu@gmail.com> | 11 | 2012-10-02 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 12 | ||
| 3 | * makefile.w32-in ($(BLD)/alloc.$(O), $(BLD)/gmalloc.$(O)): | 13 | * makefile.w32-in ($(BLD)/alloc.$(O), $(BLD)/gmalloc.$(O)): |
diff --git a/src/buffer.c b/src/buffer.c index 580ea671b43..6925675fd5a 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -2464,7 +2464,7 @@ current buffer is cleared. */) | |||
| 2464 | begv = BEGV, zv = ZV; | 2464 | begv = BEGV, zv = ZV; |
| 2465 | 2465 | ||
| 2466 | if (narrowed) | 2466 | if (narrowed) |
| 2467 | Fwiden (); | 2467 | error ("Changing multibyteness in a narrowed buffer"); |
| 2468 | 2468 | ||
| 2469 | if (NILP (flag)) | 2469 | if (NILP (flag)) |
| 2470 | { | 2470 | { |
| @@ -3847,17 +3847,16 @@ for the rear of the overlay advance when text is inserted there | |||
| 3847 | end = OVERLAY_END (overlay); | 3847 | end = OVERLAY_END (overlay); |
| 3848 | if (OVERLAY_POSITION (end) < b->overlay_center) | 3848 | if (OVERLAY_POSITION (end) < b->overlay_center) |
| 3849 | { | 3849 | { |
| 3850 | if (b->overlays_after) | 3850 | eassert (b->overlays_after); |
| 3851 | XOVERLAY (overlay)->next = b->overlays_after; | 3851 | XOVERLAY (overlay)->next = b->overlays_after; |
| 3852 | set_buffer_overlays_after (b, XOVERLAY (overlay)); | 3852 | set_buffer_overlays_after (b, XOVERLAY (overlay)); |
| 3853 | } | 3853 | } |
| 3854 | else | 3854 | else |
| 3855 | { | 3855 | { |
| 3856 | if (b->overlays_before) | 3856 | eassert (b->overlays_before); |
| 3857 | XOVERLAY (overlay)->next = b->overlays_before; | 3857 | XOVERLAY (overlay)->next = b->overlays_before; |
| 3858 | set_buffer_overlays_before (b, XOVERLAY (overlay)); | 3858 | set_buffer_overlays_before (b, XOVERLAY (overlay)); |
| 3859 | } | 3859 | } |
| 3860 | |||
| 3861 | /* This puts it in the right list, and in the right order. */ | 3860 | /* This puts it in the right list, and in the right order. */ |
| 3862 | recenter_overlay_lists (b, b->overlay_center); | 3861 | recenter_overlay_lists (b, b->overlay_center); |
| 3863 | 3862 | ||
| @@ -4141,7 +4140,7 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, | |||
| 4141 | /* Put all the overlays we want in a vector in overlay_vec. | 4140 | /* Put all the overlays we want in a vector in overlay_vec. |
| 4142 | Store the length in len. */ | 4141 | Store the length in len. */ |
| 4143 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, | 4142 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, |
| 4144 | 0, 0, 0); | 4143 | NULL, NULL, 0); |
| 4145 | 4144 | ||
| 4146 | /* Make a list of them all. */ | 4145 | /* Make a list of them all. */ |
| 4147 | result = Flist (noverlays, overlay_vec); | 4146 | result = Flist (noverlays, overlay_vec); |
diff --git a/src/coding.h b/src/coding.h index c45d2ef86e2..989552bf667 100644 --- a/src/coding.h +++ b/src/coding.h | |||
| @@ -646,10 +646,8 @@ struct coding_system | |||
| 646 | for file names, if any. */ | 646 | for file names, if any. */ |
| 647 | #define ENCODE_FILE(name) \ | 647 | #define ENCODE_FILE(name) \ |
| 648 | (! NILP (Vfile_name_coding_system) \ | 648 | (! NILP (Vfile_name_coding_system) \ |
| 649 | && !EQ (Vfile_name_coding_system, make_number (0)) \ | ||
| 650 | ? code_convert_string_norecord (name, Vfile_name_coding_system, 1) \ | 649 | ? code_convert_string_norecord (name, Vfile_name_coding_system, 1) \ |
| 651 | : (! NILP (Vdefault_file_name_coding_system) \ | 650 | : (! NILP (Vdefault_file_name_coding_system) \ |
| 652 | && !EQ (Vdefault_file_name_coding_system, make_number (0)) \ | ||
| 653 | ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 1) \ | 651 | ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 1) \ |
| 654 | : name)) | 652 | : name)) |
| 655 | 653 | ||
| @@ -658,10 +656,8 @@ struct coding_system | |||
| 658 | for file names, if any. */ | 656 | for file names, if any. */ |
| 659 | #define DECODE_FILE(name) \ | 657 | #define DECODE_FILE(name) \ |
| 660 | (! NILP (Vfile_name_coding_system) \ | 658 | (! NILP (Vfile_name_coding_system) \ |
| 661 | && !EQ (Vfile_name_coding_system, make_number (0)) \ | ||
| 662 | ? code_convert_string_norecord (name, Vfile_name_coding_system, 0) \ | 659 | ? code_convert_string_norecord (name, Vfile_name_coding_system, 0) \ |
| 663 | : (! NILP (Vdefault_file_name_coding_system) \ | 660 | : (! NILP (Vdefault_file_name_coding_system) \ |
| 664 | && !EQ (Vdefault_file_name_coding_system, make_number (0)) \ | ||
| 665 | ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 0) \ | 661 | ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 0) \ |
| 666 | : name)) | 662 | : name)) |
| 667 | 663 | ||
| @@ -670,7 +666,6 @@ struct coding_system | |||
| 670 | for system functions, if any. */ | 666 | for system functions, if any. */ |
| 671 | #define ENCODE_SYSTEM(str) \ | 667 | #define ENCODE_SYSTEM(str) \ |
| 672 | (! NILP (Vlocale_coding_system) \ | 668 | (! NILP (Vlocale_coding_system) \ |
| 673 | && !EQ (Vlocale_coding_system, make_number (0)) \ | ||
| 674 | ? code_convert_string_norecord (str, Vlocale_coding_system, 1) \ | 669 | ? code_convert_string_norecord (str, Vlocale_coding_system, 1) \ |
| 675 | : str) | 670 | : str) |
| 676 | 671 | ||
| @@ -678,7 +673,6 @@ struct coding_system | |||
| 678 | for system functions, if any. */ | 673 | for system functions, if any. */ |
| 679 | #define DECODE_SYSTEM(str) \ | 674 | #define DECODE_SYSTEM(str) \ |
| 680 | (! NILP (Vlocale_coding_system) \ | 675 | (! NILP (Vlocale_coding_system) \ |
| 681 | && !EQ (Vlocale_coding_system, make_number (0)) \ | ||
| 682 | ? code_convert_string_norecord (str, Vlocale_coding_system, 0) \ | 676 | ? code_convert_string_norecord (str, Vlocale_coding_system, 0) \ |
| 683 | : str) | 677 | : str) |
| 684 | 678 | ||
diff --git a/src/frame.c b/src/frame.c index edb90038a48..2fcf7275f9c 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -632,7 +632,7 @@ affects all frames on the same terminal device. */) | |||
| 632 | Lisp_Object terminal; | 632 | Lisp_Object terminal; |
| 633 | 633 | ||
| 634 | terminal = Fassq (Qterminal, parms); | 634 | terminal = Fassq (Qterminal, parms); |
| 635 | if (!NILP (terminal)) | 635 | if (CONSP (terminal)) |
| 636 | { | 636 | { |
| 637 | terminal = XCDR (terminal); | 637 | terminal = XCDR (terminal); |
| 638 | t = get_terminal (terminal, 1); | 638 | t = get_terminal (terminal, 1); |