diff options
| author | Karel Zak <kzak@redhat.com> | 2023-10-27 11:42:15 +0200 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2023-11-20 22:25:47 +0100 |
| commit | 429b5840348918a08a79fb5646f1933b790bb26e (patch) | |
| tree | efbcfcb775cf00eaae91bcef1bc884481a846eb4 | |
| parent | 7de6a8a91448c9bffdd3370a9884d6c4771de4f3 (diff) | |
| download | util-linux-429b5840348918a08a79fb5646f1933b790bb26e.tar.gz | |
libsmartcols: don't directly access struct members
Signed-off-by: Karel Zak <kzak@redhat.com>
| -rw-r--r-- | libsmartcols/src/column.c | 8 | ||||
| -rw-r--r-- | libsmartcols/src/filter-param.c | 6 |
2 files changed, 7 insertions, 7 deletions
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); |
