From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.bugs Subject: bug#35062: [PATCH 2/4] constify a bit of xterm.c Date: Mon, 1 Apr 2019 01:37:40 +0300 Message-ID: <20190331223742.1351-3-Hi-Angel@yandex.ru> References: <20190331223742.1351-1-Hi-Angel@yandex.ru> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="152683"; mail-complaints-to="usenet@blaine.gmane.org" To: 35062@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 01 00:38:56 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hAj6N-000ddK-PZ for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Apr 2019 00:38:56 +0200 Original-Received: from localhost ([127.0.0.1]:35706 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAj6M-0007Iv-PB for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Mar 2019 18:38:54 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:32824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAj5a-0006tv-62 for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2019 18:38:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAj5Y-0001jc-Vu for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2019 18:38:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53292) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hAj5Y-0001jS-Qh for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2019 18:38:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hAj5Y-0006nX-N7 for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2019 18:38:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Konstantin Kharlamov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Mar 2019 22:38:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35062 X-GNU-PR-Package: emacs Original-Received: via spool by 35062-submit@debbugs.gnu.org id=B35062.155407188226088 (code B ref 35062); Sun, 31 Mar 2019 22:38:04 +0000 Original-Received: (at 35062) by debbugs.gnu.org; 31 Mar 2019 22:38:02 +0000 Original-Received: from localhost ([127.0.0.1]:38595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAj5W-0006mZ-4D for submit@debbugs.gnu.org; Sun, 31 Mar 2019 18:38:02 -0400 Original-Received: from forward104j.mail.yandex.net ([5.45.198.247]:36382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAj5S-0006lk-9x for 35062@debbugs.gnu.org; Sun, 31 Mar 2019 18:37:59 -0400 Original-Received: from mxback11g.mail.yandex.net (mxback11g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:90]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 4E3B14A0192 for <35062@debbugs.gnu.org>; Mon, 1 Apr 2019 01:37:51 +0300 (MSK) Original-Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback11g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id iEK34kR9go-bpvmOn2k; Mon, 01 Apr 2019 01:37:51 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1554071871; bh=IvoO6KHtxmKzSQD9bN1cJeRcD7MJohaZCNg01cRklpQ=; h=In-Reply-To:Subject:To:From:References:Date:Message-Id; b=ZIXWs9gTx/91iAlAnbNakYKysRj1TU+fuhSGWKnKFvBXJ8DCDLde/rjofyTMbkAlw kf3sF1VRuMUzId9sRT0w3eG81Egq5cudHtuQyY3lAikSoS6abnzuJZxq/0dvcNeM8J aTeeNrL/UE01nmUULyga6dNKMLTxGFWXzNvs/GJk= Authentication-Results: mxback11g.mail.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id XiGbwCpRwI-bo6u15mX; Mon, 01 Apr 2019 01:37:50 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190331223742.1351-1-Hi-Angel@yandex.ru> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:156995 Archived-At: * src/xterm.c: make code easier to follow by making explicit that some variables are immutable --- src/xterm.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index e8f1e576a38..8354ce00700 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -495,9 +495,9 @@ x_cr_draw_image (struct frame *f, GC gc, cairo_surface_t *image, cairo_fill_preserve (cr); } - int orig_image_width = cairo_image_surface_get_width (image); + const int orig_image_width = cairo_image_surface_get_width (image); if (image_width == 0) image_width = orig_image_width; - int orig_image_height = cairo_image_surface_get_height (image); + const int orig_image_height = cairo_image_surface_get_height (image); if (image_height == 0) image_height = orig_image_height; cairo_pattern_t *pattern = cairo_pattern_create_for_surface (image); @@ -1006,7 +1006,7 @@ x_update_begin (struct frame *f) if (FRAME_GTK_WIDGET (f)) { GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); - int scale = xg_get_scale (f); + const int scale = xg_get_scale (f); width = scale * gdk_window_get_width (w); height = scale * gdk_window_get_height (w); } @@ -1300,15 +1300,15 @@ x_clear_under_internal_border (struct frame *f) { if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0) { - int border = FRAME_INTERNAL_BORDER_WIDTH (f); - int width = FRAME_PIXEL_WIDTH (f); - int height = FRAME_PIXEL_HEIGHT (f); + const int border = FRAME_INTERNAL_BORDER_WIDTH (f); + const int width = FRAME_PIXEL_WIDTH (f); + const int height = FRAME_PIXEL_HEIGHT (f); #ifdef USE_GTK - int margin = 0; + const int margin = 0; #else - int margin = FRAME_TOP_MARGIN_HEIGHT (f); + const int margin = FRAME_TOP_MARGIN_HEIGHT (f); #endif - int face_id = + const int face_id = !NILP (Vface_remapping_alist) ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID) : INTERNAL_BORDER_FACE_ID; @@ -1455,7 +1455,7 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring Drawable drawable = FRAME_X_DRAWABLE (f); char *bits; Pixmap pixmap, clipmask = (Pixmap) 0; - int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); + const int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); XGCValues gcv; if (p->wd > 8) @@ -1704,7 +1704,7 @@ static void x_set_glyph_string_clipping (struct glyph_string *s) { XRectangle *r = s->clip; - int n = get_glyph_string_clip_rects (s, r, 2); + const int n = get_glyph_string_clip_rects (s, r, 2); if (n > 0) x_set_clip_rectangles (s->f, s->gc, r, n); @@ -1797,7 +1797,7 @@ x_draw_glyph_string_background (struct glyph_string *s, bool force_p) shouldn't be drawn in the first place. */ if (!s->background_filled_p) { - int box_line_width = max (s->face->box_line_width, 0); + const int box_line_width = max (s->face->box_line_width, 0); if (s->stippled_p) { @@ -1908,15 +1908,15 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s) } else if (! s->first_glyph->u.cmp.automatic) { - int y = s->ybase; + const int y = s->ybase; for (i = 0, j = s->cmp_from; i < s->nchars; i++, j++) /* TAB in a composition means display glyphs with padding space on the left or right. */ if (COMPOSITION_GLYPH (s->cmp, j) != '\t') { - int xx = x + s->cmp->offsets[j * 2]; - int yy = y - s->cmp->offsets[j * 2 + 1]; + const int xx = x + s->cmp->offsets[j * 2]; + const int yy = y - s->cmp->offsets[j * 2 + 1]; font->driver->draw (s, j, j + 1, xx, yy, false); if (s->face->overstrike) @@ -5516,7 +5516,7 @@ x_send_scroll_bar_event (Lisp_Object window, enum scroll_bar_part part, struct frame *f = XFRAME (w->frame); intptr_t iw = (intptr_t) w; verify (INTPTR_WIDTH <= 64); - int sign_shift = INTPTR_WIDTH - 32; + const int sign_shift = INTPTR_WIDTH - 32; block_input (); -- 2.21.0