From: Karel Zak Date: Fri, 27 Oct 2023 09:42:15 +0000 (+0200) Subject: libsmartcols: don't directly access struct members X-Git-Tag: v2.40-rc1~151^2~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=429b5840348918a08a79fb5646f1933b790bb26e;p=thirdparty%2Futil-linux.git libsmartcols: don't directly access struct members Signed-off-by: Karel Zak --- diff --git a/libsmartcols/src/column.c b/libsmartcols/src/column.c index bf3b1a2d0d..c0b364ec69 100644 --- a/libsmartcols/src/column.c +++ b/libsmartcols/src/column.c @@ -221,9 +221,9 @@ int scols_column_get_json_type(const struct libscols_column *cl) * by this function. If the format is not specified then filter and counters * try to use SCOLS_JSON_* types, if also not define than defaults to string. * - * If simple string conversion is not possible then application (which want to - * use filters and counters) needs to define data function. See - * scols_column_set_datafunc(). + * If a simple string conversion is not possible then application (which want + * to use filters and counters) needs to define data function to do the + * conversion. See scols_column_set_datafunc(). * * Returns: 0, a negative value in case of an error. * @@ -244,7 +244,7 @@ int scols_column_set_data_type(struct libscols_column *cl, int type) */ int scols_column_get_data_type(const struct libscols_column *cl) { - return cl->data_type;; + return cl->data_type; } /** * scols_column_get_table: diff --git a/libsmartcols/src/filter-param.c b/libsmartcols/src/filter-param.c index cc2d7af4a4..eacf18405a 100644 --- a/libsmartcols/src/filter-param.c +++ b/libsmartcols/src/filter-param.c @@ -227,9 +227,9 @@ int filter_param_reset_holder(struct filter_param *n) if (n->type != SCOLS_DATA_NONE) return 0; /* already set */ - if (n->col->data_type) + if (scols_column_get_data_type(n->col)) /* use by application defined type */ - n->type = n->col->data_type; + n->type = scols_column_get_data_type(n->col); else { /* use by JSON defined type, default to string if not specified */ switch (n->col->json_type) { @@ -283,7 +283,7 @@ static int fetch_holder_data(struct libscols_filter *fltr __attribute__((__unuse if (ce) data = cl->datafunc(n->col, ce, cl->datafunc_data); if (data) - rc = param_set_data(n, cl->data_type, data); + rc = param_set_data(n, scols_column_get_data_type(cl), data); } else { /* read column data, use it as string */ data = scols_line_get_column_data(ln, n->col);