emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 39d3e8b: Fix last change in 'char_width'


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-26 39d3e8b: Fix last change in 'char_width'
Date: Sun, 29 Jul 2018 10:42:58 -0400 (EDT)

branch: emacs-26
commit 39d3e8b6bc465df7a9400165a4d813af8af37237
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix last change in 'char_width'
    
    * src/character.c (char_width): Make sure variable C is always
    initialized.  (Bug#32276)
---
 src/character.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/character.c b/src/character.c
index 48268e0..b96161e 100644
--- a/src/character.c
+++ b/src/character.c
@@ -289,15 +289,18 @@ char_width (int c, struct Lisp_Char_Table *dp)
       if (VECTORP (disp))
        for (i = 0, width = 0; i < ASIZE (disp); i++)
          {
-           int c;
+           int c = -1;
            ch = AREF (disp, i);
            if (GLYPH_CODE_P (ch))
              c = GLYPH_CODE_CHAR (ch);
            else if (CHARACTERP (ch))
              c = XFASTINT (ch);
-           int w = CHARACTER_WIDTH (c);
-           if (INT_ADD_WRAPV (width, w, &width))
-             string_overflow ();
+           if (c >= 0)
+             {
+               int w = CHARACTER_WIDTH (c);
+               if (INT_ADD_WRAPV (width, w, &width))
+                 string_overflow ();
+             }
          }
     }
   return width;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]