From 85f24f61597cf8f38d5913e66a87c883f6a7690d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 10:57:31 -0700 Subject: [PATCH] * indent.c (MULTIBYTE_BYTES_WIDTH): New args bytes, width. All uses changed. (MULTIBYTE_BYTES_WIDTH, scan_for_column, compute_motion): Rename locals to avoid shadowing. --- src/ChangeLog | 5 +++++ src/indent.c | 30 +++++++++++++++--------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 1b44f7585d6..21a588a87da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2011-03-15 Paul Eggert + * indent.c (MULTIBYTE_BYTES_WIDTH): New args bytes, width. + All uses changed. + (MULTIBYTE_BYTES_WIDTH, scan_for_column, compute_motion): + Rename locals to avoid shadowing. + * casefiddle.c (casify_object, casify_region): Now static. (casify_region): Mark local as initialized. diff --git a/src/indent.c b/src/indent.c index 37ce647556d..d5e7671fa8c 100644 --- a/src/indent.c +++ b/src/indent.c @@ -274,20 +274,20 @@ skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, EMACS_INT to, Lisp_Ob This macro is used in current_column_1, Fmove_to_column, and compute_motion. */ -#define MULTIBYTE_BYTES_WIDTH(p, dp) \ +#define MULTIBYTE_BYTES_WIDTH(p, dp, bytes, width) \ do { \ - int c; \ + int ch; \ \ wide_column = 0; \ - c = STRING_CHAR_AND_LENGTH (p, bytes); \ + ch = STRING_CHAR_AND_LENGTH (p, bytes); \ if (BYTES_BY_CHAR_HEAD (*p) != bytes) \ width = bytes * 4; \ else \ { \ - if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c))) \ - width = XVECTOR (DISP_CHAR_VECTOR (dp, c))->size; \ + if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch))) \ + width = XVECTOR (DISP_CHAR_VECTOR (dp, ch))->size; \ else \ - width = CHAR_WIDTH (c); \ + width = CHAR_WIDTH (ch); \ if (width > 1) \ wide_column = width; \ } \ @@ -569,14 +569,14 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) prev_col = col; { /* Check display property. */ - EMACS_INT end; - int width = check_display_width (scan, col, &end); + EMACS_INT endp; + int width = check_display_width (scan, col, &endp); if (width >= 0) { col += width; - if (end > scan) /* Avoid infinite loops with 0-width overlays. */ + if (endp > scan) /* Avoid infinite loops with 0-width overlays. */ { - scan = end; scan_byte = charpos_to_bytepos (scan); + scan = endp; scan_byte = charpos_to_bytepos (scan); continue; } } @@ -669,7 +669,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) int bytes, width, wide_column; ptr = BYTE_POS_ADDR (scan_byte); - MULTIBYTE_BYTES_WIDTH (ptr, dp); + MULTIBYTE_BYTES_WIDTH (ptr, dp, bytes, width); /* Subtract one to compensate for the increment that is going to happen below. */ scan_byte += bytes - 1; @@ -1657,15 +1657,15 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ { /* Start of multi-byte form. */ unsigned char *ptr; - int bytes, width, wide_column; + int mb_bytes, mb_width, wide_column; pos_byte--; /* rewind POS_BYTE */ ptr = BYTE_POS_ADDR (pos_byte); - MULTIBYTE_BYTES_WIDTH (ptr, dp); - pos_byte += bytes; + MULTIBYTE_BYTES_WIDTH (ptr, dp, mb_bytes, mb_width); + pos_byte += mb_bytes; if (wide_column) wide_column_end_hpos = hpos + wide_column; - hpos += width; + hpos += mb_width; } else if (VECTORP (charvec)) ++hpos; -- 2.39.2