From 9beb8baa1f1b59f8e76df62e95647c39acbac5e7 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 16 Oct 2007 16:28:39 +0000 Subject: [PATCH] * xfns.c (Fx_create_frame, Fx_display_list): * window.c (window_fixed_size_p, enlarge_window, shrink_window_lowest_first): * macterm.c (init_font_name_table): * macfns.c (Fx_create_frame, Fx_display_list): * lread.c (close_load_descs): * keyboard.c (read_char_x_menu_prompt): * fns.c (Fmember, Fmemql, Fdelete, Fset_char_table_parent): * coding.c (code_convert_region_unwind): Test the type of an object rather than just !NILP before extracting data from it. --- src/ChangeLog | 11 +++++++++++ src/coding.c | 2 +- src/fns.c | 9 +++++---- src/keyboard.c | 2 +- src/lread.c | 2 +- src/macfns.c | 4 ++-- src/macterm.c | 4 ++-- src/window.c | 14 +++++++------- src/xfns.c | 4 ++-- 9 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6f96f7da7ac..cd6dd995bcf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,16 @@ 2007-10-16 Stefan Monnier + * xfns.c (Fx_create_frame, Fx_display_list): + * window.c (window_fixed_size_p, enlarge_window) + (shrink_window_lowest_first): + * macterm.c (init_font_name_table): + * macfns.c (Fx_create_frame, Fx_display_list): + * lread.c (close_load_descs): + * keyboard.c (read_char_x_menu_prompt): + * fns.c (Fmember, Fmemql, Fdelete, Fset_char_table_parent): + * coding.c (code_convert_region_unwind): Test the type of an object + rather than just !NILP before extracting data from it. + * alloc.c (Fpurecopy): Set the pvec tag on pseudo vectors. * lisp.h (enum Lisp_Misc_Type): Del Lisp_Misc_Some_Buffer_Local_Value. diff --git a/src/coding.c b/src/coding.c index b6299097d55..b0721cc22be 100644 --- a/src/coding.c +++ b/src/coding.c @@ -5371,7 +5371,7 @@ code_convert_region_unwind (arg) inhibit_pre_post_conversion = 0; Vlast_coding_system_used = XCAR (arg); - for (arg = XCDR (arg); ! NILP (arg); arg = XCDR (arg)) + for (arg = XCDR (arg); CONSP (arg); arg = XCDR (arg)) Fkill_buffer (XCAR (arg)); UNGCPRO; diff --git a/src/fns.c b/src/fns.c index f881ed53f88..7ec0056332a 100644 --- a/src/fns.c +++ b/src/fns.c @@ -1451,7 +1451,7 @@ The value is actually the tail of LIST whose car is ELT. */) Lisp_Object list; { register Lisp_Object tail; - for (tail = list; !NILP (tail); tail = XCDR (tail)) + for (tail = list; CONSP (tail); tail = XCDR (tail)) { register Lisp_Object tem; CHECK_LIST_CONS (tail, list); @@ -1502,7 +1502,7 @@ The value is actually the tail of LIST whose car is ELT. */) if (!FLOATP (elt)) return Fmemq (elt, list); - for (tail = list; !NILP (tail); tail = XCDR (tail)) + for (tail = list; CONSP (tail); tail = XCDR (tail)) { register Lisp_Object tem; CHECK_LIST_CONS (tail, list); @@ -1806,7 +1806,7 @@ to be sure of changing the value of `foo'. */) { Lisp_Object tail, prev; - for (tail = seq, prev = Qnil; !NILP (tail); tail = XCDR (tail)) + for (tail = seq, prev = Qnil; CONSP (tail); tail = XCDR (tail)) { CHECK_LIST_CONS (tail, seq); @@ -2440,7 +2440,8 @@ Return PARENT. PARENT must be either nil or another char-table. */) { CHECK_CHAR_TABLE (parent); - for (temp = parent; !NILP (temp); temp = XCHAR_TABLE (temp)->parent) + for (temp = parent; CHAR_TABLE_P (temp); + temp = XCHAR_TABLE (temp)->parent) if (EQ (temp, char_table)) error ("Attempt to make a chartable be its own parent"); } diff --git a/src/keyboard.c b/src/keyboard.c index bd8263f9b04..fccf5c88eaa 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -8538,7 +8538,7 @@ read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu) to indicate that they came from a mouse menu, so that when present in last_nonmenu_event they won't confuse things. */ - for (tem = XCDR (value); !NILP (tem); tem = XCDR (tem)) + for (tem = XCDR (value); CONSP (tem); tem = XCDR (tem)) { record_menu_key (XCAR (tem)); if (SYMBOLP (XCAR (tem)) diff --git a/src/lread.c b/src/lread.c index 5418d82a968..77eb800b41a 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1100,7 +1100,7 @@ close_load_descs () { #ifndef WINDOWSNT Lisp_Object tail; - for (tail = load_descriptor_list; !NILP (tail); tail = XCDR (tail)) + for (tail = load_descriptor_list; CONSP (tail); tail = XCDR (tail)) emacs_close (XFASTINT (XCAR (tail))); #endif } diff --git a/src/macfns.c b/src/macfns.c index 6a12c071cee..d0b859054a6 100644 --- a/src/macfns.c +++ b/src/macfns.c @@ -2826,7 +2826,7 @@ This function is an internal primitive--use `make-frame' instead. */) /* All remaining specified parameters, which have not been "used" by x_get_arg and friends, now go in the misc. alist of the frame. */ - for (tem = parameters; !NILP (tem); tem = XCDR (tem)) + for (tem = parameters; CONSP (tem); tem = XCDR (tem)) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) f->param_alist = Fcons (XCAR (tem), f->param_alist); @@ -3402,7 +3402,7 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, Lisp_Object tail, result; result = Qnil; - for (tail = x_display_name_list; ! NILP (tail); tail = XCDR (tail)) + for (tail = x_display_name_list; CONSP (tail); tail = XCDR (tail)) result = Fcons (XCAR (XCAR (tail)), result); return result; diff --git a/src/macterm.c b/src/macterm.c index e4b9cca819c..ef1fa7c7453 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -8281,7 +8281,7 @@ init_font_name_table () Lisp_Object rest = XCDR (XCDR (text_encoding_info)); if (size > 0 || style == normal) - for (; !NILP (rest); rest = XCDR (rest)) + for (; CONSP (rest); rest = XCDR (rest)) add_mac_font_name (name, size, style, SDATA (XCAR (rest))); } } @@ -8356,7 +8356,7 @@ init_font_name_table () { Lisp_Object rest = XCDR (XCDR (text_encoding_info)); - for (; !NILP (rest); rest = XCDR (rest)) + for (; CONSP (rest); rest = XCDR (rest)) add_mac_font_name (name, assc_entry->fontSize, assc_entry->fontStyle, SDATA (XCAR (rest))); diff --git a/src/window.c b/src/window.c index efdf309121b..1819b2dc024 100644 --- a/src/window.c +++ b/src/window.c @@ -2670,12 +2670,12 @@ window_fixed_size_p (w, width_p, check_siblings_p) { Lisp_Object child; - for (child = w->prev; !NILP (child); child = XWINDOW (child)->prev) + for (child = w->prev; WINDOWP (child); child = XWINDOW (child)->prev) if (!window_fixed_size_p (XWINDOW (child), width_p, 0)) break; if (NILP (child)) - for (child = w->next; !NILP (child); child = XWINDOW (child)->next) + for (child = w->next; WINDOWP (child); child = XWINDOW (child)->next) if (!window_fixed_size_p (XWINDOW (child), width_p, 0)) break; @@ -4291,10 +4291,10 @@ enlarge_window (window, delta, horiz_flag) /* Find the total we can get from other siblings without deleting them. */ maximum = 0; - for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) + for (next = p->next; WINDOWP (next); next = XWINDOW (next)->next) maximum += (*sizefun) (next) - window_min_size (XWINDOW (next), horiz_flag, 0, 0); - for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) + for (prev = p->prev; WINDOWP (prev); prev = XWINDOW (prev)->prev) maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev), horiz_flag, 0, 0); @@ -4442,10 +4442,10 @@ enlarge_window (window, delta, horiz_flag) Lisp_Object s; int n = 1; - for (s = w->next; !NILP (s); s = XWINDOW (s)->next) + for (s = w->next; WINDOWP (s); s = XWINDOW (s)->next) if (!window_fixed_size_p (XWINDOW (s), horiz_flag, 0)) ++n; - for (s = w->prev; !NILP (s); s = XWINDOW (s)->prev) + for (s = w->prev; WINDOWP (s); s = XWINDOW (s)->prev) if (!window_fixed_size_p (XWINDOW (s), horiz_flag, 0)) ++n; @@ -4701,7 +4701,7 @@ shrink_window_lowest_first (w, height) /* Find the last child. We are taking space from lowest windows first, so we iterate over children from the last child backwards. */ - for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next) + for (child = w->vchild; WINDOWP (child); child = XWINDOW (child)->next) last_child = child; /* Assign new heights. We leave only MIN_SAFE_WINDOW_HEIGHT. */ diff --git a/src/xfns.c b/src/xfns.c index fe4d1c8335f..43ed2f75514 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3468,7 +3468,7 @@ This function is an internal primitive--use `make-frame' instead. */) /* All remaining specified parameters, which have not been "used" by x_get_arg and friends, now go in the misc. alist of the frame. */ - for (tem = parms; !NILP (tem); tem = XCDR (tem)) + for (tem = parms; CONSP (tem); tem = XCDR (tem)) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) f->param_alist = Fcons (XCAR (tem), f->param_alist); @@ -4156,7 +4156,7 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, Lisp_Object tail, result; result = Qnil; - for (tail = x_display_name_list; ! NILP (tail); tail = XCDR (tail)) + for (tail = x_display_name_list; CONSP (tail); tail = XCDR (tail)) result = Fcons (XCAR (XCAR (tail)), result); return result; -- 2.39.2