From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Redundant if clause in xdisp.c? Date: Sat, 29 Aug 2009 15:46:32 +0300 Message-ID: <8363c6bxef.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1251550006 4160 80.91.229.12 (29 Aug 2009 12:46:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Aug 2009 12:46:46 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 29 14:46:39 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MhNKI-0000xj-DM for ged-emacs-devel@m.gmane.org; Sat, 29 Aug 2009 14:46:38 +0200 Original-Received: from localhost ([127.0.0.1]:48316 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhNKH-0006j0-HM for ged-emacs-devel@m.gmane.org; Sat, 29 Aug 2009 08:46:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MhNKB-0006ie-Is for emacs-devel@gnu.org; Sat, 29 Aug 2009 08:46:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MhNK9-0006gr-Md for emacs-devel@gnu.org; Sat, 29 Aug 2009 08:46:30 -0400 Original-Received: from [199.232.76.173] (port=50781 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhNK9-0006gn-HR for emacs-devel@gnu.org; Sat, 29 Aug 2009 08:46:29 -0400 Original-Received: from mtaout4.012.net.il ([84.95.2.10]:28213 helo=mtaout3.012.net.il) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MhNK8-0005Or-VO for emacs-devel@gnu.org; Sat, 29 Aug 2009 08:46:29 -0400 Original-Received: from conversion-daemon.i_mtaout3.012.net.il by i_mtaout3.012.net.il (HyperSendmail v2004.12) id <0KP5001001O6ES00@i_mtaout3.012.net.il> for emacs-devel@gnu.org; Sat, 29 Aug 2009 15:46:27 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.228.144.38]) by i_mtaout3.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0KP50005625ESBB0@i_mtaout3.012.net.il> for emacs-devel@gnu.org; Sat, 29 Aug 2009 15:46:27 +0300 (IDT) X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 9.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:114831 Archived-At: Unless I'm missing something, both branches of the if clause below (from xdisp.c:redisplay_internal) are identical, except for the comments: if (Z - CHARPOS (tlendpos) == ZV) { /* This line ends at end of (accessible part of) buffer. There is no newline to count. */ delta = (Z - CHARPOS (tlendpos) - MATRIX_ROW_START_CHARPOS (row)); delta_bytes = (Z_BYTE - BYTEPOS (tlendpos) - MATRIX_ROW_START_BYTEPOS (row)); } else { /* This line ends in a newline. Must take account of the newline and the rest of the text that follows. */ delta = (Z - CHARPOS (tlendpos) - MATRIX_ROW_START_CHARPOS (row)); delta_bytes = (Z_BYTE - BYTEPOS (tlendpos) - MATRIX_ROW_START_BYTEPOS (row)); } increment_matrix_positions (w->current_matrix, this_line_vpos + 1, w->current_matrix->nrows, delta, delta_bytes); Okay to remove the condition and to collapse both branches into a single code fragment?