From: Masatake YAMATO Date: Mon, 15 Dec 2025 20:15:30 +0000 (+0900) Subject: lslocks: (refactor) use global bytes in get_json_type_for_column() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1caa3907b22e3d7fee9b20431d146bb34c1be82c;p=thirdparty%2Futil-linux.git lslocks: (refactor) use global bytes in get_json_type_for_column() `get_json_type_for_column()` used to take `representing_in_bytes`, but every caller passed the global `bytes`. The parameter added no value and split the ownership of the setting. Drop the parameter and read the global `bytes` instead. This aligns lslocks with lsblk and prepares for adding `-Q/--filter`. lsblk also reads global `bytes` defined in lsblk.c No functional change intended. Signed-off-by: Masatake YAMATO --- diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c index bfdd3f160..f8d029d1e 100644 --- a/misc-utils/lslocks.c +++ b/misc-utils/lslocks.c @@ -721,11 +721,11 @@ static void rem_tnode(void *node) free(node); } -static int get_json_type_for_column(int column_id, int representing_in_bytes) +static int get_json_type_for_column(int column_id) { switch (column_id) { case COL_SIZE: - if (!representing_in_bytes) + if (!bytes) return SCOLS_JSON_STRING; FALLTHROUGH; case COL_PID: @@ -776,7 +776,7 @@ static struct libscols_table *init_scols_table(void) if (json) { int id = get_column_id(i); - int json_type = get_json_type_for_column(id, bytes); + int json_type = get_json_type_for_column(id); scols_column_set_json_type(cl, json_type); } @@ -841,7 +841,7 @@ static void __attribute__((__noreturn__)) list_columns(void) for (size_t i = 0; i < ARRAY_SIZE(infos); i++) { if (i != COL_SIZE) { - int json_type = get_json_type_for_column(i, bytes); + int json_type = get_json_type_for_column(i); xcolumn_list_table_append_line(col_tb, infos[i].name, json_type, NULL, _(infos[i].help));