bison-patches
[Top][All Lists]
Advanced

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

don't use strlen to compute visual width


From: Akim Demaille
Subject: don't use strlen to compute visual width
Date: Tue, 23 Jun 2020 08:29:25 +0200

commit 670c7e7a75ba5ef69083cdbc92efa99a5d1a7107
Author: Akim Demaille <akim.demaille@gmail.com>
Date:   Tue Jun 23 08:27:26 2020 +0200

    don't use strlen to compute visual width
    
    * src/output.c (prepare_symbol_names): Use mbswidth.

diff --git a/src/output.c b/src/output.c
index 509502dd..eb8a3bf8 100644
--- a/src/output.c
+++ b/src/output.c
@@ -23,6 +23,7 @@
 
 #include <filename.h> /* IS_PATH_WITH_DIR */
 #include <get-errno.h>
+#include <mbswidth.h>
 #include <path-join.h>
 #include <quotearg.h>
 #include <spawn-pipe.h>
@@ -236,7 +237,7 @@ prepare_symbol_names (char const *muscle_name)
       /* Width of the next token, including the two quotes, the
          comma and the space.  */
       int width
-        = strlen (cp) + 2
+        = mbswidth (cp, 0) + 2
         + (translatable ? strlen ("N_()") : 0);
 
       if (col + width > 75)




reply via email to

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