[pacman-dev] [PATCH 2/2] pacman/util: use string_length to calculate line length

Dave Reisner d at falconindy.com
Sat Aug 20 13:19:19 EDT 2011


This is measuring strings that are potentially localized, so we need a
multibyte aware function to count characters instead of bytes.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
assuming you didn't already get this one, Dan...

 src/pacman/util.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/pacman/util.c b/src/pacman/util.c
index 0c83020..d154e84 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -533,7 +533,7 @@ static alpm_list_t *table_create_format(const alpm_list_t *header,
 	/* now use the column width info to generate format strings */
 	for(i = longest_strs; i; i = alpm_list_next(i)) {
 		const char *display;
-		colwidth = strlen(alpm_list_getdata(i)) + padding;
+		colwidth = string_length(alpm_list_getdata(i)) + padding;
 		totalwidth += colwidth;
 
 		/* right align the last column for a cleaner table display */
-- 
1.7.6



More information about the pacman-dev mailing list