summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/line.c
diff options
context:
space:
mode:
authorKarel Zak2014-05-20 15:04:11 +0200
committerKarel Zak2014-05-20 15:04:11 +0200
commit57a86f9bff68f24b167df9c571a09c6b89712296 (patch)
treeb5872b3929c083b96c14fa0140157c59f8e78d2d /libsmartcols/src/line.c
parentsetterm: fix 'bright' in usage, remove unnecessary error message (diff)
downloadkernel-qcow2-util-linux-57a86f9bff68f24b167df9c571a09c6b89712296.tar.gz
kernel-qcow2-util-linux-57a86f9bff68f24b167df9c571a09c6b89712296.tar.xz
kernel-qcow2-util-linux-57a86f9bff68f24b167df9c571a09c6b89712296.zip
libsmartcols: add scols_sort_table()
* add pointer to column cmp() function [scols_column_set_cmpfunc()] * allow to store per-cell application private data (to make it possible to sort tables on data independent on cell output data) [scols_cell_set_userdata() ...] * make it possible to access line cell by column [scols_line_get_column_cell()] Sort and cmp() stuff based on patches from Shakur Shams Mullick. Co-Author: Shakur Shams Mullick <shakursmullick@gmail.com> Signed-off-by: Shakur Shams Mullick <shakursmullick@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/src/line.c')
-rw-r--r--libsmartcols/src/line.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libsmartcols/src/line.c b/libsmartcols/src/line.c
index 32c8964ad..611209081 100644
--- a/libsmartcols/src/line.c
+++ b/libsmartcols/src/line.c
@@ -355,6 +355,25 @@ struct libscols_cell *scols_line_get_cell(struct libscols_line *ln,
}
/**
+ * scols_line_get_column_cell:
+ * @ln: a pointer to a struct libscols_line instance
+ * @cl: pointer to cell
+ *
+ * Like scols_line_get_cell() by cell is referenced by column.
+ *
+ * Returns: the @n-th cell in @ln, NULL in case of an error.
+ */
+struct libscols_cell *scols_line_get_column_cell(
+ struct libscols_line *ln,
+ struct libscols_column *cl)
+{
+ assert(ln);
+ assert(cl);
+
+ return scols_line_get_cell(ln, cl->seqnum);
+}
+
+/**
* scols_line_set_data:
* @ln: a pointer to a struct libscols_cell instance
* @n: number of the cell, whose data is to be set