break;
case TABLE_BOOLEAN:
- buffer.b = !!va_arg(ap, int);
+ buffer.b = va_arg(ap, int);
data = &buffer.b;
break;
break;
}
+ va_end(ap);
return 0;
}
if (column == (size_t) -1)
break;
}
+ va_end(ap);
return 0;
}
assert_not_reached("Unexpected type?");
}
-
return d->formatted;
}
return 0;
}
-static char *align_string_mem(const char *str, size_t old_length, size_t new_length, unsigned percent) {
- size_t w = 0, space, lspace;
+static char *align_string_mem(const char *str, size_t new_length, unsigned percent) {
+ size_t w = 0, space, lspace, old_length;
const char *p;
char *ret;
size_t i;
assert(str);
assert(percent <= 100);
- if (old_length == (size_t) -1)
- old_length = strlen(str);
+ old_length = strlen(str);
/* Determine current width on screen */
p = str;
if (l > width[j]) {
/* Field is wider than allocated space. Let's ellipsize */
- buffer = ellipsize_mem(field, (size_t) -1, width[j], d->ellipsize_percent);
+ buffer = ellipsize(field, width[j], d->ellipsize_percent);
if (!buffer)
return -ENOMEM;
} else if (l < width[j]) {
/* Field is shorter than allocated space. Let's align with spaces */
- buffer = align_string_mem(field, (size_t) -1, width[j], d->align_percent);
+ buffer = align_string_mem(field, width[j], d->align_percent);
if (!buffer)
return -ENOMEM;