]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: allow to set data by reference to libscols_column
authorKarel Zak <kzak@redhat.com>
Tue, 12 Jan 2016 10:39:03 +0000 (11:39 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 12 Jan 2016 10:39:03 +0000 (11:39 +0100)
References: https://github.com/karelzak/util-linux/issues/251
Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/docs/libsmartcols-sections.txt
libsmartcols/src/libsmartcols.h.in
libsmartcols/src/libsmartcols.sym
libsmartcols/src/line.c

index 30fb30225f8cb150c20ea4ce198f0c48fbd393b6..f2cb62b79c05fce3eb124e539e08990528ecb637 100644 (file)
@@ -60,9 +60,11 @@ scols_line_get_parent
 scols_line_get_userdata
 scols_line_has_children
 scols_line_next_child
+scols_line_refer_column_data
 scols_line_refer_data
 scols_line_remove_child
 scols_line_set_color
+scols_line_set_column_data
 scols_line_set_data
 scols_line_set_userdata
 scols_new_line
index 381a8eb9b6571e5e7f814d875b67edb00796eaab..0331f3713ff6ad05fe87a4a40fc3bb619b9b10da 100644 (file)
@@ -170,6 +170,8 @@ extern struct libscols_cell *scols_line_get_column_cell(
                                        struct libscols_column *cl);
 extern int scols_line_set_data(struct libscols_line *ln, size_t n, const char *data);
 extern int scols_line_refer_data(struct libscols_line *ln, size_t n, char *data);
+extern int scols_line_set_column_data(struct libscols_line *ln, struct libscols_column *cl, const char *data);
+extern int scols_line_refer_column_data(struct libscols_line *ln, struct libscols_column *cl, char *data);
 extern struct libscols_line *scols_copy_line(struct libscols_line *ln);
 
 /* table */
index e3176ba5b3342032d664b966e9668401effe64f3..9a060cf73e8fc2cd3d77f54b96d70516922672af 100644 (file)
@@ -123,5 +123,7 @@ global:
 
 SMARTCOLS_2.28 {
 global:
+       scols_line_refer_column_data;
+       scols_line_set_column_data;
        scols_table_enable_nowrap;
 } SMARTCOLS_2.27;
index 12826a96197c49506d0ffba7942631f19d6c12bb..b80ad675ff0ecf9e7491eaacb60e6ba5dfe73261 100644 (file)
@@ -385,6 +385,23 @@ int scols_line_set_data(struct libscols_line *ln, size_t n, const char *data)
        return scols_cell_set_data(ce, data);
 }
 
+/**
+ * scols_line_set_column_data:
+ * @ln: a pointer to a struct libscols_cell instance
+ * @cl: column, whose data is to be set
+ * @data: actual data to set
+ *
+ * The same as scols_line_set_data() but cell is referenced by column object.
+ *
+ * Returns: 0, a negative value in case of an error.
+ */
+int scols_line_set_column_data(struct libscols_line *ln,
+                              struct libscols_column *cl,
+                              const char *data)
+{
+       return scols_line_set_data(ln, cl->seqnum, data);
+}
+
 /**
  * scols_line_refer_data:
  * @ln: a pointer to a struct libscols_cell instance
@@ -402,6 +419,23 @@ int scols_line_refer_data(struct libscols_line *ln, size_t n, char *data)
        return scols_cell_refer_data(ce, data);
 }
 
+/**
+ * scols_line_refer_column_data:
+ * @ln: a pointer to a struct libscols_cell instance
+ * @cl: column, whose data is to be set
+ * @data: actual data to refer to
+ *
+ * The same as scols_line_refer_data() but cell is referenced by column object.
+ *
+ * Returns: 0, a negative value in case of an error.
+ */
+int scols_line_refer_column_data(struct libscols_line *ln,
+                              struct libscols_column *cl,
+                              char *data)
+{
+       return scols_line_refer_data(ln, cl->seqnum, data);
+}
+
 /**
  * scols_copy_line:
  * @ln: a pointer to a struct libscols_cell instance