From unknown Sun Jun 22 11:46:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19698: Use bool, not int, to flag face changes Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Jan 2015 01:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19698 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 19698@debbugs.gnu.org Cc: Eli Zaretskii X-Debbugs-Original-To: Emacs bug reports and feature requests Received: via spool by submit@debbugs.gnu.org id=B.142232151618357 (code B ref -1); Tue, 27 Jan 2015 01:19:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Jan 2015 01:18:36 +0000 Received: from localhost ([127.0.0.1]:57411 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFunb-0004m0-9R for submit@debbugs.gnu.org; Mon, 26 Jan 2015 20:18:36 -0500 Received: from eggs.gnu.org ([208.118.235.92]:56633) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFunY-0004ll-4S for submit@debbugs.gnu.org; Mon, 26 Jan 2015 20:18:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFunR-0004g1-0Q for submit@debbugs.gnu.org; Mon, 26 Jan 2015 20:18:26 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35921) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFunQ-0004fx-Se for submit@debbugs.gnu.org; Mon, 26 Jan 2015 20:18:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFunO-0003es-KM for bug-gnu-emacs@gnu.org; Mon, 26 Jan 2015 20:18:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFunL-0004ex-Cx for bug-gnu-emacs@gnu.org; Mon, 26 Jan 2015 20:18:22 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]:36995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFunL-0004eX-0Q; Mon, 26 Jan 2015 20:18:19 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id CBB3FA60059; Mon, 26 Jan 2015 17:18:12 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vgOEcGgT49kB; Mon, 26 Jan 2015 17:18:12 -0800 (PST) Received: from [192.168.1.9] (pool-173-55-11-52.lsanca.fios.verizon.net [173.55.11.52]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 3DA88A6000C; Mon, 26 Jan 2015 17:18:12 -0800 (PST) Message-ID: <54C6E754.3000105@cs.ucla.edu> Date: Mon, 26 Jan 2015 17:18:12 -0800 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020005000908060000000701" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) This is a multi-part message in MIME format. --------------020005000908060000000701 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Tags: patch Severity: wishlist Attached is a minor patch to simplify the xfaces.c code by using a bool flag 'face_change' instead of an int counter 'face_change_count'. This affects the MS-Windows port so I'm filing it as a bug report to give Eli a heads-up. --------------020005000908060000000701 Content-Type: text/x-patch; name="0001-Use-bool-not-int-to-track-face-changes.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Use-bool-not-int-to-track-face-changes.patch" >From 5f2e7e99ce3b3dcff438522075d4d887aab04915 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 26 Jan 2015 17:11:04 -0800 Subject: [PATCH] Use bool, not int, to track face changes * xfaces.c (face_change): Rename from face_change_count, and change from int to bool. The var is now true (instead of nonzero) if attributes have changed; this is simpler. All uses changed. --- src/ChangeLog | 5 +++++ src/dispextern.h | 4 ++-- src/frame.c | 2 +- src/msdos.c | 2 +- src/w32fns.c | 8 ++++---- src/xdisp.c | 12 ++++++------ src/xfaces.c | 32 ++++++++++++++++---------------- src/xfns.c | 12 ++++++------ 8 files changed, 41 insertions(+), 36 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 8e5166e..017df6e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2015-01-27 Paul Eggert + Use bool, not int, to track face changes + * xfaces.c (face_change): Rename from face_change_count, and + change from int to bool. The var is now true (instead of nonzero) + if attributes have changed; this is simpler. All uses changed. + Use bool for boolean in xfaces.c * dispextern.h: Adjust to signature changes. * font.c (font_at, font_range): diff --git a/src/dispextern.h b/src/dispextern.h index 31e7262..4139479 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1850,10 +1850,10 @@ GLYPH_CODE_P (Lisp_Object gc) : TYPE_MAXIMUM (EMACS_INT))))); } -/* Non-zero means face attributes have been changed since the last +/* True means face attributes have been changed since the last redisplay. Used in redisplay_internal. */ -extern int face_change_count; +extern bool face_change; /* For reordering of bidirectional text. */ diff --git a/src/frame.c b/src/frame.c index 2ce5a62..e4adfe8 100644 --- a/src/frame.c +++ b/src/frame.c @@ -3632,7 +3632,7 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu XSETFRAME (frame, f); x_set_font (f, Fframe_parameter (frame, Qfont), Qnil); - ++face_change_count; + face_change = true; windows_or_buffers_changed = 18; } } diff --git a/src/msdos.c b/src/msdos.c index 3c2277e..8b05b34 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -1733,7 +1733,7 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist) if (redraw) { - face_change_count++; /* forces xdisp.c to recompute basic faces */ + face_change = true; /* forces xdisp.c to recompute basic faces */ if (f == SELECTED_FRAME ()) redraw_frame (f); } diff --git a/src/w32fns.c b/src/w32fns.c index c269c4f..0b39939 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -5623,7 +5623,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, ptrdiff_t count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3; struct kboard *kb; - int face_change_count_before = face_change_count; + bool face_change_before = face_change; Lisp_Object buffer; struct buffer *old_buffer; @@ -5835,11 +5835,11 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, f->can_x_set_window_size = true; /* Setting attributes of faces of the tooltip frame from resources - and similar will increment face_change_count, which leads to the + and similar will set face_change, which leads to the clearing of all current matrices. Since this isn't necessary - here, avoid it by resetting face_change_count to the value it + here, avoid it by resetting face_change to the value it had before we created the tip frame. */ - face_change_count = face_change_count_before; + face_change = face_change_before; /* Discard the unwind_protect. */ return unbind_to (count, frame); diff --git a/src/xdisp.c b/src/xdisp.c index 71871ec..940db32 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2724,9 +2724,9 @@ init_iterator (struct it *it, struct window *w, free realized faces now because they depend on face definitions that might have changed. Don't free faces while there might be desired matrices pending which reference these faces. */ - if (face_change_count && !inhibit_free_realized_faces) + if (face_change && !inhibit_free_realized_faces) { - face_change_count = 0; + face_change = false; free_all_realized_faces (Qnil); } @@ -13372,10 +13372,10 @@ redisplay_internal (void) last_glyphless_glyph_frame = NULL; last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); - /* If face_change_count is non-zero, init_iterator will free all - realized faces, which includes the faces referenced from current - matrices. So, we can't reuse current matrices in this case. */ - if (face_change_count) + /* If face_change, init_iterator will free all realized faces, which + includes the faces referenced from current matrices. So, we + can't reuse current matrices in this case. */ + if (face_change) windows_or_buffers_changed = 47; if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf)) diff --git a/src/xfaces.c b/src/xfaces.c index 7c9f626..6e01ab0 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -313,10 +313,10 @@ static int clear_font_table_count; #endif /* HAVE_WINDOW_SYSTEM */ -/* Non-zero means face attributes have been changed since the last +/* True means face attributes have been changed since the last redisplay. Used in redisplay_internal. */ -int face_change_count; +bool face_change; /* True means don't display bold text if a face's foreground and background colors are the inverse of the default colors of the @@ -694,7 +694,7 @@ Optional THOROUGHLY non-nil means try to free unused fonts, too. */) (Lisp_Object thoroughly) { clear_face_cache (!NILP (thoroughly)); - ++face_change_count; + face_change = true; windows_or_buffers_changed = 53; return Qnil; } @@ -2530,11 +2530,11 @@ Value is a vector of face attributes. */) /* Changing a named face means that all realized faces depending on that face are invalid. Since we cannot tell which realized faces depend on the face, make sure they are all removed. This is done - by incrementing face_change_count. The next call to - init_iterator will then free realized faces. */ + by setting face_change. The next call to init_iterator will then + free realized faces. */ if (NILP (Fget (face, Qface_no_inherit))) { - ++face_change_count; + face_change = true; windows_or_buffers_changed = 54; } @@ -2609,11 +2609,11 @@ The value is TO. */) /* Changing a named face means that all realized faces depending on that face are invalid. Since we cannot tell which realized faces depend on the face, make sure they are all removed. This is done - by incrementing face_change_count. The next call to - init_iterator will then free realized faces. */ + by setting face_change. The next call to init_iterator will then + free realized faces. */ if (NILP (Fget (to, Qface_no_inherit))) { - ++face_change_count; + face_change = true; windows_or_buffers_changed = 55; } @@ -3107,13 +3107,13 @@ FRAME 0 means change the face on all frames, and change the default /* Changing a named face means that all realized faces depending on that face are invalid. Since we cannot tell which realized faces depend on the face, make sure they are all removed. This is done - by incrementing face_change_count. The next call to - init_iterator will then free realized faces. */ + by setting face_change. The next call to init_iterator will then + free realized faces. */ if (!EQ (frame, Qt) && NILP (Fget (face, Qface_no_inherit)) && NILP (Fequal (old_value, value))) { - ++face_change_count; + face_change = true; windows_or_buffers_changed = 56; } @@ -3281,12 +3281,12 @@ update_face_from_frame_parameter (struct frame *f, Lisp_Object param, /* Changing a named face means that all realized faces depending on that face are invalid. Since we cannot tell which realized faces depend on the face, make sure they are all removed. This is done - by incrementing face_change_count. The next call to - init_iterator will then free realized faces. */ + by setting face_change. The next call to init_iterator will then + free realized faces. */ if (!NILP (face) && NILP (Fget (face, Qface_no_inherit))) { - ++face_change_count; + face_change = true; windows_or_buffers_changed = 57; } } @@ -5820,7 +5820,7 @@ is non-nil. */) (Lisp_Object suppress) { tty_suppress_bold_inverse_default_colors_p = !NILP (suppress); - ++face_change_count; + face_change = true; return suppress; } diff --git a/src/xfns.c b/src/xfns.c index 9dd0086..9412a75 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4921,7 +4921,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, int width, height; ptrdiff_t count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3; - int face_change_count_before = face_change_count; + bool face_change_before = face_change; Lisp_Object buffer; struct buffer *old_buffer; @@ -5218,11 +5218,11 @@ x_create_tip_frame (struct x_display_info *dpyinfo, f->can_x_set_window_size = true; /* Setting attributes of faces of the tooltip frame from resources - and similar will increment face_change_count, which leads to the - clearing of all current matrices. Since this isn't necessary - here, avoid it by resetting face_change_count to the value it - had before we created the tip frame. */ - face_change_count = face_change_count_before; + and similar will set face_change, which leads to the clearing of + all current matrices. Since this isn't necessary here, avoid it + by resetting face_change to the value it had before we created + the tip frame. */ + face_change = face_change_before; /* Discard the unwind_protect. */ return unbind_to (count, frame); -- 2.1.0 --------------020005000908060000000701-- From unknown Sun Jun 22 11:46:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19698: Use bool, not int, to flag face changes Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Jan 2015 18:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19698 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Paul Eggert Cc: 19698@debbugs.gnu.org X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org Reply-To: Eli Zaretskii Received: via spool by submit@debbugs.gnu.org id=B.142238286025026 (code B ref -1); Tue, 27 Jan 2015 18:21:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Jan 2015 18:21:00 +0000 Received: from localhost ([127.0.0.1]:58244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YGAl1-0006Va-F0 for submit@debbugs.gnu.org; Tue, 27 Jan 2015 13:20:59 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42471) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YGAkz-0006VK-EE for submit@debbugs.gnu.org; Tue, 27 Jan 2015 13:20:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGAks-0007oQ-PO for submit@debbugs.gnu.org; Tue, 27 Jan 2015 13:20:51 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:56055) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGAks-0007oL-MU for submit@debbugs.gnu.org; Tue, 27 Jan 2015 13:20:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGAkr-0000D9-Lv for bug-gnu-emacs@gnu.org; Tue, 27 Jan 2015 13:20:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGAkm-0007nS-Hs for bug-gnu-emacs@gnu.org; Tue, 27 Jan 2015 13:20:49 -0500 Received: from mtaout23.012.net.il ([80.179.55.175]:46300) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGAkm-0007n6-AZ for bug-gnu-emacs@gnu.org; Tue, 27 Jan 2015 13:20:44 -0500 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0NIU00400LAI8U00@a-mtaout23.012.net.il> for bug-gnu-emacs@gnu.org; Tue, 27 Jan 2015 20:20:42 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NIU004JFLMI6G40@a-mtaout23.012.net.il>; Tue, 27 Jan 2015 20:20:42 +0200 (IST) Date: Tue, 27 Jan 2015 20:20:33 +0200 From: Eli Zaretskii In-reply-to: <54C6E754.3000105@cs.ucla.edu> X-012-Sender: halo1@inter.net.il Message-id: <838ugoozke.fsf@gnu.org> References: <54C6E754.3000105@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > Date: Mon, 26 Jan 2015 17:18:12 -0800 > From: Paul Eggert > CC: Eli Zaretskii > > Attached is a minor patch to simplify the xfaces.c code by using a bool flag > 'face_change' instead of an int counter 'face_change_count'. This affects the > MS-Windows port so I'm filing it as a bug report to give Eli a heads-up. Thanks, it looks good to me. From unknown Sun Jun 22 11:46:10 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Paul Eggert Subject: bug#19698: closed (Re: Use bool, not int, to flag face changes) Message-ID: References: <54C935A6.7030903@cs.ucla.edu> <54C6E754.3000105@cs.ucla.edu> X-Gnu-PR-Message: they-closed 19698 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 19698@debbugs.gnu.org Date: Wed, 28 Jan 2015 19:18:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1422472683-18172-1" This is a multi-part message in MIME format... ------------=_1422472683-18172-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #19698: Use bool, not int, to flag face changes which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 19698@debbugs.gnu.org. --=20 19698: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D19698 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1422472683-18172-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 19698-done) by debbugs.gnu.org; 28 Jan 2015 19:17:05 +0000 Received: from localhost ([127.0.0.1]:59253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YGY6q-0004hq-J4 for submit@debbugs.gnu.org; Wed, 28 Jan 2015 14:17:04 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]:41386) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YGY6n-0004hH-Bc for 19698-done@debbugs.gnu.org; Wed, 28 Jan 2015 14:17:02 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 54A17A60063; Wed, 28 Jan 2015 11:16:55 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L-VncabAyS8z; Wed, 28 Jan 2015 11:16:54 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id D3F10A60062; Wed, 28 Jan 2015 11:16:54 -0800 (PST) Message-ID: <54C935A6.7030903@cs.ucla.edu> Date: Wed, 28 Jan 2015 11:16:54 -0800 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Eli Zaretskii Subject: Re: Use bool, not int, to flag face changes References: <54C6E754.3000105@cs.ucla.edu> <838ugoozke.fsf@gnu.org> In-Reply-To: <838ugoozke.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 19698-done Cc: 19698-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 01/27/2015 10:20 AM, Eli Zaretskii wrote: >> Date: Mon, 26 Jan 2015 17:18:12 -0800 >> From: Paul Eggert >> CC: Eli Zaretskii >> >> Attached is a minor patch to simplify the xfaces.c code by using a bool flag >> 'face_change' instead of an int counter 'face_change_count'. This affects the >> MS-Windows port so I'm filing it as a bug report to give Eli a heads-up. > Thanks, it looks good to me. Thanks for checking. I commited it to master as cdee38ab61b383f1190d29470319bce3693c7dd9 and marking this as done. ------------=_1422472683-18172-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 Jan 2015 01:18:36 +0000 Received: from localhost ([127.0.0.1]:57411 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFunb-0004m0-9R for submit@debbugs.gnu.org; Mon, 26 Jan 2015 20:18:36 -0500 Received: from eggs.gnu.org ([208.118.235.92]:56633) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFunY-0004ll-4S for submit@debbugs.gnu.org; Mon, 26 Jan 2015 20:18:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFunR-0004g1-0Q for submit@debbugs.gnu.org; Mon, 26 Jan 2015 20:18:26 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35921) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFunQ-0004fx-Se for submit@debbugs.gnu.org; Mon, 26 Jan 2015 20:18:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFunO-0003es-KM for bug-gnu-emacs@gnu.org; Mon, 26 Jan 2015 20:18:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFunL-0004ex-Cx for bug-gnu-emacs@gnu.org; Mon, 26 Jan 2015 20:18:22 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]:36995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFunL-0004eX-0Q; Mon, 26 Jan 2015 20:18:19 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id CBB3FA60059; Mon, 26 Jan 2015 17:18:12 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vgOEcGgT49kB; Mon, 26 Jan 2015 17:18:12 -0800 (PST) Received: from [192.168.1.9] (pool-173-55-11-52.lsanca.fios.verizon.net [173.55.11.52]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 3DA88A6000C; Mon, 26 Jan 2015 17:18:12 -0800 (PST) Message-ID: <54C6E754.3000105@cs.ucla.edu> Date: Mon, 26 Jan 2015 17:18:12 -0800 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Emacs bug reports and feature requests Subject: Use bool, not int, to flag face changes Content-Type: multipart/mixed; boundary="------------020005000908060000000701" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) This is a multi-part message in MIME format. --------------020005000908060000000701 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Tags: patch Severity: wishlist Attached is a minor patch to simplify the xfaces.c code by using a bool flag 'face_change' instead of an int counter 'face_change_count'. This affects the MS-Windows port so I'm filing it as a bug report to give Eli a heads-up. --------------020005000908060000000701 Content-Type: text/x-patch; name="0001-Use-bool-not-int-to-track-face-changes.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Use-bool-not-int-to-track-face-changes.patch" >From 5f2e7e99ce3b3dcff438522075d4d887aab04915 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 26 Jan 2015 17:11:04 -0800 Subject: [PATCH] Use bool, not int, to track face changes * xfaces.c (face_change): Rename from face_change_count, and change from int to bool. The var is now true (instead of nonzero) if attributes have changed; this is simpler. All uses changed. --- src/ChangeLog | 5 +++++ src/dispextern.h | 4 ++-- src/frame.c | 2 +- src/msdos.c | 2 +- src/w32fns.c | 8 ++++---- src/xdisp.c | 12 ++++++------ src/xfaces.c | 32 ++++++++++++++++---------------- src/xfns.c | 12 ++++++------ 8 files changed, 41 insertions(+), 36 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 8e5166e..017df6e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2015-01-27 Paul Eggert + Use bool, not int, to track face changes + * xfaces.c (face_change): Rename from face_change_count, and + change from int to bool. The var is now true (instead of nonzero) + if attributes have changed; this is simpler. All uses changed. + Use bool for boolean in xfaces.c * dispextern.h: Adjust to signature changes. * font.c (font_at, font_range): diff --git a/src/dispextern.h b/src/dispextern.h index 31e7262..4139479 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1850,10 +1850,10 @@ GLYPH_CODE_P (Lisp_Object gc) : TYPE_MAXIMUM (EMACS_INT))))); } -/* Non-zero means face attributes have been changed since the last +/* True means face attributes have been changed since the last redisplay. Used in redisplay_internal. */ -extern int face_change_count; +extern bool face_change; /* For reordering of bidirectional text. */ diff --git a/src/frame.c b/src/frame.c index 2ce5a62..e4adfe8 100644 --- a/src/frame.c +++ b/src/frame.c @@ -3632,7 +3632,7 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu XSETFRAME (frame, f); x_set_font (f, Fframe_parameter (frame, Qfont), Qnil); - ++face_change_count; + face_change = true; windows_or_buffers_changed = 18; } } diff --git a/src/msdos.c b/src/msdos.c index 3c2277e..8b05b34 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -1733,7 +1733,7 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist) if (redraw) { - face_change_count++; /* forces xdisp.c to recompute basic faces */ + face_change = true; /* forces xdisp.c to recompute basic faces */ if (f == SELECTED_FRAME ()) redraw_frame (f); } diff --git a/src/w32fns.c b/src/w32fns.c index c269c4f..0b39939 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -5623,7 +5623,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, ptrdiff_t count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3; struct kboard *kb; - int face_change_count_before = face_change_count; + bool face_change_before = face_change; Lisp_Object buffer; struct buffer *old_buffer; @@ -5835,11 +5835,11 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, f->can_x_set_window_size = true; /* Setting attributes of faces of the tooltip frame from resources - and similar will increment face_change_count, which leads to the + and similar will set face_change, which leads to the clearing of all current matrices. Since this isn't necessary - here, avoid it by resetting face_change_count to the value it + here, avoid it by resetting face_change to the value it had before we created the tip frame. */ - face_change_count = face_change_count_before; + face_change = face_change_before; /* Discard the unwind_protect. */ return unbind_to (count, frame); diff --git a/src/xdisp.c b/src/xdisp.c index 71871ec..940db32 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2724,9 +2724,9 @@ init_iterator (struct it *it, struct window *w, free realized faces now because they depend on face definitions that might have changed. Don't free faces while there might be desired matrices pending which reference these faces. */ - if (face_change_count && !inhibit_free_realized_faces) + if (face_change && !inhibit_free_realized_faces) { - face_change_count = 0; + face_change = false; free_all_realized_faces (Qnil); } @@ -13372,10 +13372,10 @@ redisplay_internal (void) last_glyphless_glyph_frame = NULL; last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); - /* If face_change_count is non-zero, init_iterator will free all - realized faces, which includes the faces referenced from current - matrices. So, we can't reuse current matrices in this case. */ - if (face_change_count) + /* If face_change, init_iterator will free all realized faces, which + includes the faces referenced from current matrices. So, we + can't reuse current matrices in this case. */ + if (face_change) windows_or_buffers_changed = 47; if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf)) diff --git a/src/xfaces.c b/src/xfaces.c index 7c9f626..6e01ab0 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -313,10 +313,10 @@ static int clear_font_table_count; #endif /* HAVE_WINDOW_SYSTEM */ -/* Non-zero means face attributes have been changed since the last +/* True means face attributes have been changed since the last redisplay. Used in redisplay_internal. */ -int face_change_count; +bool face_change; /* True means don't display bold text if a face's foreground and background colors are the inverse of the default colors of the @@ -694,7 +694,7 @@ Optional THOROUGHLY non-nil means try to free unused fonts, too. */) (Lisp_Object thoroughly) { clear_face_cache (!NILP (thoroughly)); - ++face_change_count; + face_change = true; windows_or_buffers_changed = 53; return Qnil; } @@ -2530,11 +2530,11 @@ Value is a vector of face attributes. */) /* Changing a named face means that all realized faces depending on that face are invalid. Since we cannot tell which realized faces depend on the face, make sure they are all removed. This is done - by incrementing face_change_count. The next call to - init_iterator will then free realized faces. */ + by setting face_change. The next call to init_iterator will then + free realized faces. */ if (NILP (Fget (face, Qface_no_inherit))) { - ++face_change_count; + face_change = true; windows_or_buffers_changed = 54; } @@ -2609,11 +2609,11 @@ The value is TO. */) /* Changing a named face means that all realized faces depending on that face are invalid. Since we cannot tell which realized faces depend on the face, make sure they are all removed. This is done - by incrementing face_change_count. The next call to - init_iterator will then free realized faces. */ + by setting face_change. The next call to init_iterator will then + free realized faces. */ if (NILP (Fget (to, Qface_no_inherit))) { - ++face_change_count; + face_change = true; windows_or_buffers_changed = 55; } @@ -3107,13 +3107,13 @@ FRAME 0 means change the face on all frames, and change the default /* Changing a named face means that all realized faces depending on that face are invalid. Since we cannot tell which realized faces depend on the face, make sure they are all removed. This is done - by incrementing face_change_count. The next call to - init_iterator will then free realized faces. */ + by setting face_change. The next call to init_iterator will then + free realized faces. */ if (!EQ (frame, Qt) && NILP (Fget (face, Qface_no_inherit)) && NILP (Fequal (old_value, value))) { - ++face_change_count; + face_change = true; windows_or_buffers_changed = 56; } @@ -3281,12 +3281,12 @@ update_face_from_frame_parameter (struct frame *f, Lisp_Object param, /* Changing a named face means that all realized faces depending on that face are invalid. Since we cannot tell which realized faces depend on the face, make sure they are all removed. This is done - by incrementing face_change_count. The next call to - init_iterator will then free realized faces. */ + by setting face_change. The next call to init_iterator will then + free realized faces. */ if (!NILP (face) && NILP (Fget (face, Qface_no_inherit))) { - ++face_change_count; + face_change = true; windows_or_buffers_changed = 57; } } @@ -5820,7 +5820,7 @@ is non-nil. */) (Lisp_Object suppress) { tty_suppress_bold_inverse_default_colors_p = !NILP (suppress); - ++face_change_count; + face_change = true; return suppress; } diff --git a/src/xfns.c b/src/xfns.c index 9dd0086..9412a75 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4921,7 +4921,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, int width, height; ptrdiff_t count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3; - int face_change_count_before = face_change_count; + bool face_change_before = face_change; Lisp_Object buffer; struct buffer *old_buffer; @@ -5218,11 +5218,11 @@ x_create_tip_frame (struct x_display_info *dpyinfo, f->can_x_set_window_size = true; /* Setting attributes of faces of the tooltip frame from resources - and similar will increment face_change_count, which leads to the - clearing of all current matrices. Since this isn't necessary - here, avoid it by resetting face_change_count to the value it - had before we created the tip frame. */ - face_change_count = face_change_count_before; + and similar will set face_change, which leads to the clearing of + all current matrices. Since this isn't necessary here, avoid it + by resetting face_change to the value it had before we created + the tip frame. */ + face_change = face_change_before; /* Discard the unwind_protect. */ return unbind_to (count, frame); -- 2.1.0 --------------020005000908060000000701-- ------------=_1422472683-18172-1--