aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen Raeburn2000-03-30 09:56:31 +0000
committerKen Raeburn2000-03-30 09:56:31 +0000
commit8801a864d2f7d9b6a77dfffa606f27f338127582 (patch)
tree470499e90d35dabee56b08f00c6841a886dccdee /src
parent326855a0f45fe45c4ddd9000046ed6a9aa31534b (diff)
downloademacs-8801a864d2f7d9b6a77dfffa606f27f338127582.tar.gz
emacs-8801a864d2f7d9b6a77dfffa606f27f338127582.zip
* lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW, XSUBR, XBUFFER):
Verify correct object type before returning pointer, using eassert. * frame.h (XFRAME): Likewise. * buffer.c (Frename_buffer, Fset_buffer_multibyte, swap_out_buffer_local_variables, Fmove_overlay): Don't apply XSYMBOL, XBUFFER, etc, to values that may be nil or of the wrong type. * data.c (set_internal): Likewise. * dispextern.h (WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P): Likewise. * fileio.c (auto_save_1): Likewise. * insdel.c (check_markers): Likewise. * marker.c (buf_charpos_to_bytepos, unchain_marker): Likewise. * undo.c (record_insert): Likewise. * vmsproc.c (child_sig): Likewise. * window.c (unshow_buffer, window_loop): Likewise. * xterm.c (x_erase_phys_cursor): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog22
-rw-r--r--src/buffer.c20
-rw-r--r--src/data.c3
-rw-r--r--src/dispextern.h2
-rw-r--r--src/fileio.c3
-rw-r--r--src/frame.h2
-rw-r--r--src/insdel.c2
-rw-r--r--src/lisp.h16
-rw-r--r--src/marker.c6
-rw-r--r--src/undo.c3
-rw-r--r--src/vmsproc.c4
-rw-r--r--src/window.c9
-rw-r--r--src/xterm.c3
13 files changed, 63 insertions, 32 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ed700166530..1d09e191d7d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,25 @@
12000-03-30 Ken Raeburn <raeburn@gnu.org>
2
3 * lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW,
4 XSUBR, XBUFFER): Verify correct object type before returning
5 pointer, using eassert.
6 * frame.h (XFRAME): Likewise.
7
8 * buffer.c (Frename_buffer, Fset_buffer_multibyte,
9 swap_out_buffer_local_variables, Fmove_overlay): Don't apply
10 XSYMBOL, XBUFFER, etc, to values that may be nil or of the wrong
11 type.
12 * data.c (set_internal): Likewise.
13 * dispextern.h (WINDOW_WANTS_MODELINE_P,
14 WINDOW_WANTS_HEADER_LINE_P): Likewise.
15 * fileio.c (auto_save_1): Likewise.
16 * insdel.c (check_markers): Likewise.
17 * marker.c (buf_charpos_to_bytepos, unchain_marker): Likewise.
18 * undo.c (record_insert): Likewise.
19 * vmsproc.c (child_sig): Likewise.
20 * window.c (unshow_buffer, window_loop): Likewise.
21 * xterm.c (x_erase_phys_cursor): Likewise.
22
12000-03-30 Gerd Moellmann <gerd@gnu.org> 232000-03-30 Gerd Moellmann <gerd@gnu.org>
2 24
3 * xfns.c (free_image_cache): Free the cache structure itself 25 * xfns.c (free_image_cache): Free the cache structure itself
diff --git a/src/buffer.c b/src/buffer.c
index d54555d3242..848e9990776 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -887,14 +887,14 @@ This does not change the name of the visited file (if any).")
887 error ("Empty string is invalid as a buffer name"); 887 error ("Empty string is invalid as a buffer name");
888 888
889 tem = Fget_buffer (newname); 889 tem = Fget_buffer (newname);
890 /* Don't short-circuit if UNIQUE is t. That is a useful way to rename
891 the buffer automatically so you can create another with the original name.
892 It makes UNIQUE equivalent to
893 (rename-buffer (generate-new-buffer-name NEWNAME)). */
894 if (NILP (unique) && XBUFFER (tem) == current_buffer)
895 return current_buffer->name;
896 if (!NILP (tem)) 890 if (!NILP (tem))
897 { 891 {
892 /* Don't short-circuit if UNIQUE is t. That is a useful way to
893 rename the buffer automatically so you can create another
894 with the original name. It makes UNIQUE equivalent to
895 (rename-buffer (generate-new-buffer-name NEWNAME)). */
896 if (NILP (unique) && XBUFFER (tem) == current_buffer)
897 return current_buffer->name;
898 if (!NILP (unique)) 898 if (!NILP (unique))
899 newname = Fgenerate_new_buffer_name (newname, current_buffer->name); 899 newname = Fgenerate_new_buffer_name (newname, current_buffer->name);
900 else 900 else
@@ -1815,7 +1815,7 @@ but the contents viewed as characters do change.")
1815 TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE); 1815 TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE);
1816 1816
1817 tail = BUF_MARKERS (current_buffer); 1817 tail = BUF_MARKERS (current_buffer);
1818 while (XSYMBOL (tail) != XSYMBOL (Qnil)) 1818 while (! NILP (tail))
1819 { 1819 {
1820 XMARKER (tail)->charpos = XMARKER (tail)->bytepos; 1820 XMARKER (tail)->charpos = XMARKER (tail)->bytepos;
1821 tail = XMARKER (tail)->chain; 1821 tail = XMARKER (tail)->chain;
@@ -1880,7 +1880,7 @@ but the contents viewed as characters do change.")
1880 It is also a signal that it should never create a marker. */ 1880 It is also a signal that it should never create a marker. */
1881 BUF_MARKERS (current_buffer) = Qnil; 1881 BUF_MARKERS (current_buffer) = Qnil;
1882 1882
1883 while (XSYMBOL (tail) != XSYMBOL (Qnil)) 1883 while (! NILP (tail))
1884 { 1884 {
1885 XMARKER (tail)->bytepos 1885 XMARKER (tail)->bytepos
1886 = advance_to_char_boundary (XMARKER (tail)->bytepos); 1886 = advance_to_char_boundary (XMARKER (tail)->bytepos);
@@ -1996,7 +1996,7 @@ swap_out_buffer_local_variables (b)
1996 1996
1997 /* Need not do anything if some other buffer's binding is now encached. */ 1997 /* Need not do anything if some other buffer's binding is now encached. */
1998 tem = XBUFFER_LOCAL_VALUE (XSYMBOL (sym)->value)->buffer; 1998 tem = XBUFFER_LOCAL_VALUE (XSYMBOL (sym)->value)->buffer;
1999 if (XBUFFER (tem) == current_buffer) 1999 if (BUFFERP (tem) && XBUFFER (tem) == current_buffer)
2000 { 2000 {
2001 /* Symbol is set up for this buffer's old local value. 2001 /* Symbol is set up for this buffer's old local value.
2002 Set it up for the current buffer with the default value. */ 2002 Set it up for the current buffer with the default value. */
@@ -3166,7 +3166,7 @@ buffer.")
3166 3166
3167 obuffer = Fmarker_buffer (OVERLAY_START (overlay)); 3167 obuffer = Fmarker_buffer (OVERLAY_START (overlay));
3168 b = XBUFFER (buffer); 3168 b = XBUFFER (buffer);
3169 ob = XBUFFER (obuffer); 3169 ob = BUFFERP (obuffer) ? XBUFFER (obuffer) : (struct buffer *) 0;
3170 3170
3171 /* If the overlay has changed buffers, do a thorough redisplay. */ 3171 /* If the overlay has changed buffers, do a thorough redisplay. */
3172 if (!EQ (buffer, obuffer)) 3172 if (!EQ (buffer, obuffer))
diff --git a/src/data.c b/src/data.c
index f736f7f6c81..c267c5540f0 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1012,7 +1012,8 @@ set_internal (symbol, newval, buf, bindflag)
1012 isn't the right one, or if it's a Lisp_Buffer_Local_Value and 1012 isn't the right one, or if it's a Lisp_Buffer_Local_Value and
1013 the default binding is loaded, the loaded binding may be the 1013 the default binding is loaded, the loaded binding may be the
1014 wrong one. */ 1014 wrong one. */
1015 if (buf != XBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer) 1015 if (!BUFFERP (XBUFFER_LOCAL_VALUE (valcontents)->buffer)
1016 || buf != XBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer)
1016 || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame 1017 || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame
1017 && !EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame)) 1018 && !EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame))
1018 || (BUFFER_LOCAL_VALUEP (valcontents) 1019 || (BUFFER_LOCAL_VALUEP (valcontents)
diff --git a/src/dispextern.h b/src/dispextern.h
index 76578b8fde4..2665cf38d3a 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1066,6 +1066,7 @@ extern struct glyph_row scratch_glyph_row;
1066 (!MINI_WINDOW_P (W) \ 1066 (!MINI_WINDOW_P (W) \
1067 && !(W)->pseudo_window_p \ 1067 && !(W)->pseudo_window_p \
1068 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W))) \ 1068 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W))) \
1069 && BUFFERP ((W)->buffer) \
1069 && !NILP (XBUFFER ((W)->buffer)->mode_line_format)) 1070 && !NILP (XBUFFER ((W)->buffer)->mode_line_format))
1070 1071
1071/* Value is non-zero if window W wants a top line. */ 1072/* Value is non-zero if window W wants a top line. */
@@ -1074,6 +1075,7 @@ extern struct glyph_row scratch_glyph_row;
1074 (!MINI_WINDOW_P (W) \ 1075 (!MINI_WINDOW_P (W) \
1075 && !(W)->pseudo_window_p \ 1076 && !(W)->pseudo_window_p \
1076 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W))) \ 1077 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W))) \
1078 && BUFFERP ((W)->buffer) \
1077 && !NILP (XBUFFER ((W)->buffer)->header_line_format)) 1079 && !NILP (XBUFFER ((W)->buffer)->header_line_format))
1078 1080
1079 1081
diff --git a/src/fileio.c b/src/fileio.c
index 726d3fca803..b68ebfc5b71 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5144,7 +5144,8 @@ auto_save_1 ()
5144 struct stat st; 5144 struct stat st;
5145 5145
5146 /* Get visited file's mode to become the auto save file's mode. */ 5146 /* Get visited file's mode to become the auto save file's mode. */
5147 if (stat (XSTRING (current_buffer->filename)->data, &st) >= 0) 5147 if (! NILP (current_buffer->filename)
5148 && stat (XSTRING (current_buffer->filename)->data, &st) >= 0)
5148 /* But make sure we can overwrite it later! */ 5149 /* But make sure we can overwrite it later! */
5149 auto_save_mode_bits = st.st_mode | 0600; 5150 auto_save_mode_bits = st.st_mode | 0600;
5150 else 5151 else
diff --git a/src/frame.h b/src/frame.h
index 724a9ee916b..8183b516608 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -383,7 +383,7 @@ struct frame
383 383
384typedef struct frame *FRAME_PTR; 384typedef struct frame *FRAME_PTR;
385 385
386#define XFRAME(p) ((struct frame *) XPNTR (p)) 386#define XFRAME(p) (eassert (GC_FRAMEP(p)),(struct frame *) XPNTR (p))
387#define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME)) 387#define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME))
388 388
389/* Given a window, return its frame as a Lisp_Object. */ 389/* Given a window, return its frame as a Lisp_Object. */
diff --git a/src/insdel.c b/src/insdel.c
index 3cab83711ba..9facec4cf34 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -83,7 +83,7 @@ check_markers ()
83 83
84 tail = BUF_MARKERS (current_buffer); 84 tail = BUF_MARKERS (current_buffer);
85 85
86 while (XSYMBOL (tail) != XSYMBOL (Qnil)) 86 while (! NILP (tail))
87 { 87 {
88 if (XMARKER (tail)->buffer->text != current_buffer->text) 88 if (XMARKER (tail)->buffer->text != current_buffer->text)
89 abort (); 89 abort ();
diff --git a/src/lisp.h b/src/lisp.h
index 54a3bdd5855..13e734a73ea 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -432,11 +432,11 @@ extern Lisp_Object make_number ();
432 432
433/* Extract a value or address from a Lisp_Object. */ 433/* Extract a value or address from a Lisp_Object. */
434 434
435#define XCONS(a) ((struct Lisp_Cons *) XPNTR(a)) 435#define XCONS(a) (eassert (GC_CONSP(a)),(struct Lisp_Cons *) XPNTR(a))
436#define XVECTOR(a) ((struct Lisp_Vector *) XPNTR(a)) 436#define XVECTOR(a) ((struct Lisp_Vector *) XPNTR(a))
437#define XSTRING(a) ((struct Lisp_String *) XPNTR(a)) 437#define XSTRING(a) (eassert (GC_STRINGP(a)),(struct Lisp_String *) XPNTR(a))
438#define XSYMBOL(a) ((struct Lisp_Symbol *) XPNTR(a)) 438#define XSYMBOL(a) (eassert (GC_SYMBOLP(a)),(struct Lisp_Symbol *) XPNTR(a))
439#define XFLOAT(a) ((struct Lisp_Float *) XPNTR(a)) 439#define XFLOAT(a) (eassert (GC_FLOATP(a)),(struct Lisp_Float *) XPNTR(a))
440 440
441/* Misc types. */ 441/* Misc types. */
442#define XMISC(a) ((union Lisp_Misc *) XPNTR(a)) 442#define XMISC(a) ((union Lisp_Misc *) XPNTR(a))
@@ -451,10 +451,10 @@ extern Lisp_Object make_number ();
451#define XKBOARD_OBJFWD(a) (&(XMISC(a)->u_kboard_objfwd)) 451#define XKBOARD_OBJFWD(a) (&(XMISC(a)->u_kboard_objfwd))
452 452
453/* Pseudovector types. */ 453/* Pseudovector types. */
454#define XPROCESS(a) ((struct Lisp_Process *) XPNTR(a)) 454#define XPROCESS(a) (eassert (GC_PROCESSP(a)),(struct Lisp_Process *) XPNTR(a))
455#define XWINDOW(a) ((struct window *) XPNTR(a)) 455#define XWINDOW(a) (eassert (GC_WINDOWP(a)),(struct window *) XPNTR(a))
456#define XSUBR(a) ((struct Lisp_Subr *) XPNTR(a)) 456#define XSUBR(a) (eassert (GC_SUBRP(a)),(struct Lisp_Subr *) XPNTR(a))
457#define XBUFFER(a) ((struct buffer *) XPNTR(a)) 457#define XBUFFER(a) (eassert (GC_BUFFERP(a)),(struct buffer *) XPNTR(a))
458#define XCHAR_TABLE(a) ((struct Lisp_Char_Table *) XPNTR(a)) 458#define XCHAR_TABLE(a) ((struct Lisp_Char_Table *) XPNTR(a))
459#define XBOOL_VECTOR(a) ((struct Lisp_Bool_Vector *) XPNTR(a)) 459#define XBOOL_VECTOR(a) ((struct Lisp_Bool_Vector *) XPNTR(a))
460 460
diff --git a/src/marker.c b/src/marker.c
index 7e4cd4fa343..5b01738cf9d 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -168,7 +168,7 @@ buf_charpos_to_bytepos (b, charpos)
168 CONSIDER (cached_charpos, cached_bytepos); 168 CONSIDER (cached_charpos, cached_bytepos);
169 169
170 tail = BUF_MARKERS (b); 170 tail = BUF_MARKERS (b);
171 while (XSYMBOL (tail) != XSYMBOL (Qnil)) 171 while (! NILP (tail))
172 { 172 {
173 CONSIDER (XMARKER (tail)->charpos, XMARKER (tail)->bytepos); 173 CONSIDER (XMARKER (tail)->charpos, XMARKER (tail)->bytepos);
174 174
@@ -336,7 +336,7 @@ buf_bytepos_to_charpos (b, bytepos)
336 CONSIDER (cached_bytepos, cached_charpos); 336 CONSIDER (cached_bytepos, cached_charpos);
337 337
338 tail = BUF_MARKERS (b); 338 tail = BUF_MARKERS (b);
339 while (XSYMBOL (tail) != XSYMBOL (Qnil)) 339 while (! NILP (tail))
340 { 340 {
341 CONSIDER (XMARKER (tail)->bytepos, XMARKER (tail)->charpos); 341 CONSIDER (XMARKER (tail)->bytepos, XMARKER (tail)->charpos);
342 342
@@ -747,7 +747,7 @@ unchain_marker (marker)
747 747
748 tail = BUF_MARKERS (b); 748 tail = BUF_MARKERS (b);
749 prev = Qnil; 749 prev = Qnil;
750 while (XSYMBOL (tail) != XSYMBOL (Qnil)) 750 while (! GC_NILP (tail))
751 { 751 {
752 next = XMARKER (tail)->chain; 752 next = XMARKER (tail)->chain;
753 XUNMARK (next); 753 XUNMARK (next);
diff --git a/src/undo.c b/src/undo.c
index 96e3eeb687c..a498f2aae72 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -54,7 +54,8 @@ record_insert (beg, length)
54 if (NILP (pending_boundary)) 54 if (NILP (pending_boundary))
55 pending_boundary = Fcons (Qnil, Qnil); 55 pending_boundary = Fcons (Qnil, Qnil);
56 56
57 if (current_buffer != XBUFFER (last_undo_buffer)) 57 if (!BUFFERP (last_undo_buffer)
58 || current_buffer != XBUFFER (last_undo_buffer))
58 Fundo_boundary (); 59 Fundo_boundary ();
59 XSETBUFFER (last_undo_buffer, current_buffer); 60 XSETBUFFER (last_undo_buffer, current_buffer);
60 61
diff --git a/src/vmsproc.c b/src/vmsproc.c
index 122cf08bd36..15e2c9d5e61 100644
--- a/src/vmsproc.c
+++ b/src/vmsproc.c
@@ -758,7 +758,7 @@ child_sig (vs)
758 pid = vs->pid; 758 pid = vs->pid;
759 sys$setef (vs->eventFlag); 759 sys$setef (vs->eventFlag);
760 760
761 for (tail = Vprocess_alist; XSYMBOL (tail) != XSYMBOL (Qnil); tail = XCDR (tail)) 761 for (tail = Vprocess_alist; ! NILP (tail); tail = XCDR (tail))
762 { 762 {
763 proc = XCDR (XCAR (tail)); 763 proc = XCDR (XCAR (tail));
764 p = XPROCESS (proc); 764 p = XPROCESS (proc);
@@ -766,7 +766,7 @@ child_sig (vs)
766 break; 766 break;
767 } 767 }
768 768
769 if (XSYMBOL (tail) == XSYMBOL (Qnil)) 769 if (NILP (tail))
770 return; 770 return;
771 771
772 p->status = Fcons (Qexit, Fcons (make_number (vs->exitStatus), Qnil)) 772 p->status = Fcons (Qexit, Fcons (make_number (vs->exitStatus), Qnil))
diff --git a/src/window.c b/src/window.c
index 95edbf8e13e..72547cad4b1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -905,7 +905,8 @@ unshow_buffer (w)
905 So don't clobber point in that buffer. */ 905 So don't clobber point in that buffer. */
906 if (! EQ (buf, XWINDOW (selected_window)->buffer) 906 if (! EQ (buf, XWINDOW (selected_window)->buffer)
907 /* This line helps to fix Horsley's testbug.el bug. */ 907 /* This line helps to fix Horsley's testbug.el bug. */
908 && !(w != XWINDOW (b->last_selected_window) 908 && !(WINDOWP (b->last_selected_window)
909 && w != XWINDOW (b->last_selected_window)
909 && EQ (buf, XWINDOW (b->last_selected_window)->buffer))) 910 && EQ (buf, XWINDOW (b->last_selected_window)->buffer)))
910 temp_set_point_both (b, 911 temp_set_point_both (b,
911 clip_to_bounds (BUF_BEGV (b), 912 clip_to_bounds (BUF_BEGV (b),
@@ -915,7 +916,8 @@ unshow_buffer (w)
915 marker_byte_position (w->pointm), 916 marker_byte_position (w->pointm),
916 BUF_ZV_BYTE (b))); 917 BUF_ZV_BYTE (b)));
917 918
918 if (w == XWINDOW (b->last_selected_window)) 919 if (WINDOWP (b->last_selected_window)
920 && w == XWINDOW (b->last_selected_window))
919 b->last_selected_window = Qnil; 921 b->last_selected_window = Qnil;
920} 922}
921 923
@@ -1633,7 +1635,8 @@ window_loop (type, obj, mini, frames)
1633 case GET_LARGEST_WINDOW: 1635 case GET_LARGEST_WINDOW:
1634 /* Ignore dedicated windows and minibuffers. */ 1636 /* Ignore dedicated windows and minibuffers. */
1635 if (MINI_WINDOW_P (XWINDOW (w)) 1637 if (MINI_WINDOW_P (XWINDOW (w))
1636 || !NILP (XWINDOW (w)->dedicated)) 1638 || !NILP (XWINDOW (w)->dedicated)
1639 || NILP (best_window))
1637 break; 1640 break;
1638 { 1641 {
1639 struct window *best_window_ptr = XWINDOW (best_window); 1642 struct window *best_window_ptr = XWINDOW (best_window);
diff --git a/src/xterm.c b/src/xterm.c
index 216c633a584..ed08485904d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10225,7 +10225,8 @@ x_erase_phys_cursor (w)
10225 10225
10226 /* If the cursor is in the mouse face area, redisplay that when 10226 /* If the cursor is in the mouse face area, redisplay that when
10227 we clear the cursor. */ 10227 we clear the cursor. */
10228 if (w == XWINDOW (dpyinfo->mouse_face_window) 10228 if (! NILP (dpyinfo->mouse_face_window)
10229 && w == XWINDOW (dpyinfo->mouse_face_window)
10229 && (vpos > dpyinfo->mouse_face_beg_row 10230 && (vpos > dpyinfo->mouse_face_beg_row
10230 || (vpos == dpyinfo->mouse_face_beg_row 10231 || (vpos == dpyinfo->mouse_face_beg_row
10231 && hpos >= dpyinfo->mouse_face_beg_col)) 10232 && hpos >= dpyinfo->mouse_face_beg_col))