Mercurial > emacs
changeset 28417:4b675266db04
* 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.
author | Ken Raeburn <raeburn@raeburn.org> |
---|---|
date | Thu, 30 Mar 2000 09:56:31 +0000 |
parents | 24ba809218ad |
children | 5b7b3b5d54df |
files | src/ChangeLog src/buffer.c src/data.c src/dispextern.h src/fileio.c src/frame.h src/insdel.c src/lisp.h src/marker.c src/undo.c src/vmsproc.c src/window.c src/xterm.c |
diffstat | 13 files changed, 41 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/src/buffer.c Thu Mar 30 09:37:06 2000 +0000 +++ b/src/buffer.c Thu Mar 30 09:56:31 2000 +0000 @@ -887,14 +887,14 @@ error ("Empty string is invalid as a buffer name"); tem = Fget_buffer (newname); - /* Don't short-circuit if UNIQUE is t. That is a useful way to rename - the buffer automatically so you can create another with the original name. - It makes UNIQUE equivalent to - (rename-buffer (generate-new-buffer-name NEWNAME)). */ - if (NILP (unique) && XBUFFER (tem) == current_buffer) - return current_buffer->name; if (!NILP (tem)) { + /* Don't short-circuit if UNIQUE is t. That is a useful way to + rename the buffer automatically so you can create another + with the original name. It makes UNIQUE equivalent to + (rename-buffer (generate-new-buffer-name NEWNAME)). */ + if (NILP (unique) && XBUFFER (tem) == current_buffer) + return current_buffer->name; if (!NILP (unique)) newname = Fgenerate_new_buffer_name (newname, current_buffer->name); else @@ -1815,7 +1815,7 @@ TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE); tail = BUF_MARKERS (current_buffer); - while (XSYMBOL (tail) != XSYMBOL (Qnil)) + while (! NILP (tail)) { XMARKER (tail)->charpos = XMARKER (tail)->bytepos; tail = XMARKER (tail)->chain; @@ -1880,7 +1880,7 @@ It is also a signal that it should never create a marker. */ BUF_MARKERS (current_buffer) = Qnil; - while (XSYMBOL (tail) != XSYMBOL (Qnil)) + while (! NILP (tail)) { XMARKER (tail)->bytepos = advance_to_char_boundary (XMARKER (tail)->bytepos); @@ -1996,7 +1996,7 @@ /* Need not do anything if some other buffer's binding is now encached. */ tem = XBUFFER_LOCAL_VALUE (XSYMBOL (sym)->value)->buffer; - if (XBUFFER (tem) == current_buffer) + if (BUFFERP (tem) && XBUFFER (tem) == current_buffer) { /* Symbol is set up for this buffer's old local value. Set it up for the current buffer with the default value. */ @@ -3166,7 +3166,7 @@ obuffer = Fmarker_buffer (OVERLAY_START (overlay)); b = XBUFFER (buffer); - ob = XBUFFER (obuffer); + ob = BUFFERP (obuffer) ? XBUFFER (obuffer) : (struct buffer *) 0; /* If the overlay has changed buffers, do a thorough redisplay. */ if (!EQ (buffer, obuffer))
--- a/src/data.c Thu Mar 30 09:37:06 2000 +0000 +++ b/src/data.c Thu Mar 30 09:56:31 2000 +0000 @@ -1012,7 +1012,8 @@ isn't the right one, or if it's a Lisp_Buffer_Local_Value and the default binding is loaded, the loaded binding may be the wrong one. */ - if (buf != XBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer) + if (!BUFFERP (XBUFFER_LOCAL_VALUE (valcontents)->buffer) + || buf != XBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer) || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame && !EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame)) || (BUFFER_LOCAL_VALUEP (valcontents)
--- a/src/dispextern.h Thu Mar 30 09:37:06 2000 +0000 +++ b/src/dispextern.h Thu Mar 30 09:56:31 2000 +0000 @@ -1066,6 +1066,7 @@ (!MINI_WINDOW_P (W) \ && !(W)->pseudo_window_p \ && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W))) \ + && BUFFERP ((W)->buffer) \ && !NILP (XBUFFER ((W)->buffer)->mode_line_format)) /* Value is non-zero if window W wants a top line. */ @@ -1074,6 +1075,7 @@ (!MINI_WINDOW_P (W) \ && !(W)->pseudo_window_p \ && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W))) \ + && BUFFERP ((W)->buffer) \ && !NILP (XBUFFER ((W)->buffer)->header_line_format))
--- a/src/fileio.c Thu Mar 30 09:37:06 2000 +0000 +++ b/src/fileio.c Thu Mar 30 09:56:31 2000 +0000 @@ -5144,7 +5144,8 @@ struct stat st; /* Get visited file's mode to become the auto save file's mode. */ - if (stat (XSTRING (current_buffer->filename)->data, &st) >= 0) + if (! NILP (current_buffer->filename) + && stat (XSTRING (current_buffer->filename)->data, &st) >= 0) /* But make sure we can overwrite it later! */ auto_save_mode_bits = st.st_mode | 0600; else
--- a/src/frame.h Thu Mar 30 09:37:06 2000 +0000 +++ b/src/frame.h Thu Mar 30 09:56:31 2000 +0000 @@ -383,7 +383,7 @@ typedef struct frame *FRAME_PTR; -#define XFRAME(p) ((struct frame *) XPNTR (p)) +#define XFRAME(p) (eassert (GC_FRAMEP(p)),(struct frame *) XPNTR (p)) #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME)) /* Given a window, return its frame as a Lisp_Object. */
--- a/src/insdel.c Thu Mar 30 09:37:06 2000 +0000 +++ b/src/insdel.c Thu Mar 30 09:56:31 2000 +0000 @@ -83,7 +83,7 @@ tail = BUF_MARKERS (current_buffer); - while (XSYMBOL (tail) != XSYMBOL (Qnil)) + while (! NILP (tail)) { if (XMARKER (tail)->buffer->text != current_buffer->text) abort ();
--- a/src/lisp.h Thu Mar 30 09:37:06 2000 +0000 +++ b/src/lisp.h Thu Mar 30 09:56:31 2000 +0000 @@ -432,11 +432,11 @@ /* Extract a value or address from a Lisp_Object. */ -#define XCONS(a) ((struct Lisp_Cons *) XPNTR(a)) +#define XCONS(a) (eassert (GC_CONSP(a)),(struct Lisp_Cons *) XPNTR(a)) #define XVECTOR(a) ((struct Lisp_Vector *) XPNTR(a)) -#define XSTRING(a) ((struct Lisp_String *) XPNTR(a)) -#define XSYMBOL(a) ((struct Lisp_Symbol *) XPNTR(a)) -#define XFLOAT(a) ((struct Lisp_Float *) XPNTR(a)) +#define XSTRING(a) (eassert (GC_STRINGP(a)),(struct Lisp_String *) XPNTR(a)) +#define XSYMBOL(a) (eassert (GC_SYMBOLP(a)),(struct Lisp_Symbol *) XPNTR(a)) +#define XFLOAT(a) (eassert (GC_FLOATP(a)),(struct Lisp_Float *) XPNTR(a)) /* Misc types. */ #define XMISC(a) ((union Lisp_Misc *) XPNTR(a)) @@ -451,10 +451,10 @@ #define XKBOARD_OBJFWD(a) (&(XMISC(a)->u_kboard_objfwd)) /* Pseudovector types. */ -#define XPROCESS(a) ((struct Lisp_Process *) XPNTR(a)) -#define XWINDOW(a) ((struct window *) XPNTR(a)) -#define XSUBR(a) ((struct Lisp_Subr *) XPNTR(a)) -#define XBUFFER(a) ((struct buffer *) XPNTR(a)) +#define XPROCESS(a) (eassert (GC_PROCESSP(a)),(struct Lisp_Process *) XPNTR(a)) +#define XWINDOW(a) (eassert (GC_WINDOWP(a)),(struct window *) XPNTR(a)) +#define XSUBR(a) (eassert (GC_SUBRP(a)),(struct Lisp_Subr *) XPNTR(a)) +#define XBUFFER(a) (eassert (GC_BUFFERP(a)),(struct buffer *) XPNTR(a)) #define XCHAR_TABLE(a) ((struct Lisp_Char_Table *) XPNTR(a)) #define XBOOL_VECTOR(a) ((struct Lisp_Bool_Vector *) XPNTR(a))
--- a/src/marker.c Thu Mar 30 09:37:06 2000 +0000 +++ b/src/marker.c Thu Mar 30 09:56:31 2000 +0000 @@ -168,7 +168,7 @@ CONSIDER (cached_charpos, cached_bytepos); tail = BUF_MARKERS (b); - while (XSYMBOL (tail) != XSYMBOL (Qnil)) + while (! NILP (tail)) { CONSIDER (XMARKER (tail)->charpos, XMARKER (tail)->bytepos); @@ -336,7 +336,7 @@ CONSIDER (cached_bytepos, cached_charpos); tail = BUF_MARKERS (b); - while (XSYMBOL (tail) != XSYMBOL (Qnil)) + while (! NILP (tail)) { CONSIDER (XMARKER (tail)->bytepos, XMARKER (tail)->charpos); @@ -747,7 +747,7 @@ tail = BUF_MARKERS (b); prev = Qnil; - while (XSYMBOL (tail) != XSYMBOL (Qnil)) + while (! GC_NILP (tail)) { next = XMARKER (tail)->chain; XUNMARK (next);
--- a/src/undo.c Thu Mar 30 09:37:06 2000 +0000 +++ b/src/undo.c Thu Mar 30 09:56:31 2000 +0000 @@ -54,7 +54,8 @@ if (NILP (pending_boundary)) pending_boundary = Fcons (Qnil, Qnil); - if (current_buffer != XBUFFER (last_undo_buffer)) + if (!BUFFERP (last_undo_buffer) + || current_buffer != XBUFFER (last_undo_buffer)) Fundo_boundary (); XSETBUFFER (last_undo_buffer, current_buffer);
--- a/src/vmsproc.c Thu Mar 30 09:37:06 2000 +0000 +++ b/src/vmsproc.c Thu Mar 30 09:56:31 2000 +0000 @@ -758,7 +758,7 @@ pid = vs->pid; sys$setef (vs->eventFlag); - for (tail = Vprocess_alist; XSYMBOL (tail) != XSYMBOL (Qnil); tail = XCDR (tail)) + for (tail = Vprocess_alist; ! NILP (tail); tail = XCDR (tail)) { proc = XCDR (XCAR (tail)); p = XPROCESS (proc); @@ -766,7 +766,7 @@ break; } - if (XSYMBOL (tail) == XSYMBOL (Qnil)) + if (NILP (tail)) return; p->status = Fcons (Qexit, Fcons (make_number (vs->exitStatus), Qnil))
--- a/src/window.c Thu Mar 30 09:37:06 2000 +0000 +++ b/src/window.c Thu Mar 30 09:56:31 2000 +0000 @@ -905,7 +905,8 @@ So don't clobber point in that buffer. */ if (! EQ (buf, XWINDOW (selected_window)->buffer) /* This line helps to fix Horsley's testbug.el bug. */ - && !(w != XWINDOW (b->last_selected_window) + && !(WINDOWP (b->last_selected_window) + && w != XWINDOW (b->last_selected_window) && EQ (buf, XWINDOW (b->last_selected_window)->buffer))) temp_set_point_both (b, clip_to_bounds (BUF_BEGV (b), @@ -915,7 +916,8 @@ marker_byte_position (w->pointm), BUF_ZV_BYTE (b))); - if (w == XWINDOW (b->last_selected_window)) + if (WINDOWP (b->last_selected_window) + && w == XWINDOW (b->last_selected_window)) b->last_selected_window = Qnil; } @@ -1633,7 +1635,8 @@ case GET_LARGEST_WINDOW: /* Ignore dedicated windows and minibuffers. */ if (MINI_WINDOW_P (XWINDOW (w)) - || !NILP (XWINDOW (w)->dedicated)) + || !NILP (XWINDOW (w)->dedicated) + || NILP (best_window)) break; { struct window *best_window_ptr = XWINDOW (best_window);
--- a/src/xterm.c Thu Mar 30 09:37:06 2000 +0000 +++ b/src/xterm.c Thu Mar 30 09:56:31 2000 +0000 @@ -10225,7 +10225,8 @@ /* If the cursor is in the mouse face area, redisplay that when we clear the cursor. */ - if (w == XWINDOW (dpyinfo->mouse_face_window) + if (! NILP (dpyinfo->mouse_face_window) + && w == XWINDOW (dpyinfo->mouse_face_window) && (vpos > dpyinfo->mouse_face_beg_row || (vpos == dpyinfo->mouse_face_beg_row && hpos >= dpyinfo->mouse_face_beg_col))