return false;
}
- if(col_arg == NULL) {
+ if(col_arg == NULL || strcasecmp(col_arg, "b") == 0 || strcasecmp(col_arg, "bytes") == 0) {
+ tbl->column_order[col_copy_idx].output_type = UNIT_BYTE;
*err = NULL;
return true;
}
- if(strcasecmp(col_arg, "b") == 0 || strcasecmp(col_arg, "bytes") == 0) {
- tbl->column_order[col_copy_idx].output_type = UNIT_BYTE;
- }
-
tbl->column_order[col_copy_idx].output_type = CELL_OUT_UNINITIALIZED;
for(uint i = 0; i < ARRAY_SIZE(unit_suffix); i++) {
if(strcasecmp(col_arg, unit_suffix[i]) == 0) {
TBL_COL_ITER(tbl, col, curr_col, curr_col_idx) {
// FIXME: do some rounding?
uint out_type = 0;
+ u64 curr_val = val;
if(curr_col->output_type == CELL_OUT_UNINITIALIZED) {
- val = val / unit_div[UNIT_BYTE];
+ curr_val = curr_val / unit_div[UNIT_BYTE];
out_type = 0;
} else {
- val = val / unit_div[curr_col->output_type];
+ curr_val = curr_val / unit_div[curr_col->output_type];
out_type = curr_col->output_type;
}
- curr_col->cell_content = mp_printf(tbl->pool, "%lu%s", val, unit_suffix[out_type]);
+ curr_col->cell_content = mp_printf(tbl->pool, "%lu%s", curr_val, unit_suffix[out_type]);
}
}