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: (unknown) Date: Fri, 29 Jun 2012 16:20:46 +0300 Message-ID: <83lij66yq9.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1340976067 11398 80.91.229.3 (29 Jun 2012 13:21:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 29 Jun 2012 13:21:07 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Antipov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 29 15:21:06 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Skb8E-0005oi-Db for ged-emacs-devel@m.gmane.org; Fri, 29 Jun 2012 15:21:06 +0200 Original-Received: from localhost ([::1]:36380 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Skb8E-0002vs-Bo for ged-emacs-devel@m.gmane.org; Fri, 29 Jun 2012 09:21:06 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Skb86-0002vR-UQ for emacs-devel@gnu.org; Fri, 29 Jun 2012 09:21:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Skb80-0001Yq-SH for emacs-devel@gnu.org; Fri, 29 Jun 2012 09:20:58 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:55155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Skb80-0001Yb-K7 for emacs-devel@gnu.org; Fri, 29 Jun 2012 09:20:52 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0M6D00000RKLMF00@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Fri, 29 Jun 2012 16:20:49 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.210.75]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M6D000I7RQO9Y60@a-mtaout20.012.net.il>; Fri, 29 Jun 2012 16:20:49 +0300 (IDT) X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.166 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:151286 Archived-At: Dmitry, could you please explain the reason(s) for the change below? Vertical positions in a window can never be large enough to justify using ptrdiff_t (on platforms where that is wider than a 32-bit 'int'). These are pixel positions on the Emacs display, so they cannot be too large. The type of 'first_vpos' looks especially strange, since it is explicitly set to 1 at most. I'm not aware of a platform where an 'int' is not wide enough for a value 1 ;-) Using inappropriate data types makes the code harder to read and understand, because it hints that something non-obvious is going on somewhere. * xdisp.c (try_window_id): Change type of 'first_vpos' and 'vpos' to ptrdiff_t. --- src/xdisp.c 2012-06-28 12:29:37 +0000 +++ src/xdisp.c 2012-06-29 11:48:08 +0000 @@ -17761,8 +17761,8 @@ try_window_id (struct window *w) { /* Displayed to end of window, but no line containing text was displayed. Lines were deleted at the end of the window. */ - int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; - int vpos = XFASTINT (w->window_end_vpos); + ptrdiff_t first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; + ptrdiff_t vpos = XFASTINT (w->window_end_vpos); struct glyph_row *current_row = current_matrix->rows + vpos; struct glyph_row *desired_row = desired_matrix->rows + vpos;