Use mbstowcs instead of strlen where applicable

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Sergej Pupykin 2007-07-10 23:36:15 -04:00 committed by Dan McGee
parent 64e45a36f8
commit 1646fcc5bd
1 changed files with 3 additions and 3 deletions

View File

@ -167,7 +167,7 @@ void indentprint(const char *str, int indent)
if(p == NULL || *p == ' ') continue; if(p == NULL || *p == ' ') continue;
next = strchr(p, ' '); next = strchr(p, ' ');
if(next == NULL) { if(next == NULL) {
next = p + strlen(p); next = p + mbstowcs(NULL, p, 0);
} }
len = next - p; len = next - p;
if(len > (getcols() - cidx - 1)) { if(len > (getcols() - cidx - 1)) {
@ -283,13 +283,13 @@ void list_display(const char *title, const alpm_list_t *list)
const alpm_list_t *i; const alpm_list_t *i;
int cols, len; int cols, len;
len = strlen(title); len = mbstowcs(NULL, title, 0);
printf("%s ", title); printf("%s ", title);
if(list) { if(list) {
for(i = list, cols = len; i; i = alpm_list_next(i)) { for(i = list, cols = len; i; i = alpm_list_next(i)) {
char *str = alpm_list_getdata(i); char *str = alpm_list_getdata(i);
int s = strlen(str) + 2; int s = mbstowcs(NULL, str, 0) + 2;
int maxcols = getcols(); int maxcols = getcols();
if(s + cols >= maxcols) { if(s + cols >= maxcols) {
int i; int i;