From: Karel Zak Date: Tue, 12 Sep 2023 19:16:37 +0000 (+0200) Subject: libsmartcols: support SCOLS_JSON_FLOAT in print API X-Git-Tag: v2.40-rc1~151^2~67 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=477655d32033623ded334ca4cff57c9b1a51020a;p=thirdparty%2Futil-linux.git libsmartcols: support SCOLS_JSON_FLOAT in print API Signed-off-by: Karel Zak --- diff --git a/libsmartcols/src/column.c b/libsmartcols/src/column.c index 8a29dac5c8..669568c6c8 100644 --- a/libsmartcols/src/column.c +++ b/libsmartcols/src/column.c @@ -764,6 +764,8 @@ int scols_column_set_properties(struct libscols_column *cl, const char *opts) rc = scols_column_set_json_type(cl, SCOLS_JSON_STRING); else if (strncmp(value, "number", valuesz) == 0) rc = scols_column_set_json_type(cl, SCOLS_JSON_NUMBER); + else if (strncmp(value, "float", valuesz) == 0) + rc = scols_column_set_json_type(cl, SCOLS_JSON_FLOAT); else if (strncmp(value, "array-string", valuesz) == 0) rc = scols_column_set_json_type(cl, SCOLS_JSON_ARRAY_STRING); else if (strncmp(value, "array-number", valuesz) == 0) diff --git a/libsmartcols/src/print.c b/libsmartcols/src/print.c index 16c2436b37..e3c20ef0ba 100644 --- a/libsmartcols/src/print.c +++ b/libsmartcols/src/print.c @@ -481,6 +481,7 @@ static void print_json_data(struct libscols_table *tb, ul_jsonwrt_value_s(&tb->json, name, data); break; case SCOLS_JSON_NUMBER: + case SCOLS_JSON_FLOAT: /* name: 123 */ ul_jsonwrt_value_raw(&tb->json, name, data); break;