From 96960717375978e9a30ddc882c53ff1adf85b26d Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 23 Sep 2016 14:09:43 +0200 Subject: [PATCH] libsmartcols: add scols_table_get_name() Currently we have scols_table_set_name() but don't have getter for it. Signed-off-by: Igor Gnatenko --- libsmartcols/src/libsmartcols.h.in | 1 + libsmartcols/src/libsmartcols.sym | 1 + libsmartcols/src/table.c | 13 +++++++++++++ 3 files changed, 15 insertions(+) diff --git a/libsmartcols/src/libsmartcols.h.in b/libsmartcols/src/libsmartcols.h.in index de2f271cf..b36bcb105 100644 --- a/libsmartcols/src/libsmartcols.h.in +++ b/libsmartcols/src/libsmartcols.h.in @@ -195,6 +195,7 @@ extern struct libscols_line *scols_copy_line(const struct libscols_line *ln); /* table */ extern int scols_table_colors_wanted(const struct libscols_table *tb); extern int scols_table_set_name(struct libscols_table *tb, const char *name); +extern const char *scols_table_get_name(const struct libscols_table *tb); extern struct libscols_cell *scols_table_get_title(struct libscols_table *tb); extern int scols_table_is_raw(const struct libscols_table *tb); extern int scols_table_is_ascii(const struct libscols_table *tb); diff --git a/libsmartcols/src/libsmartcols.sym b/libsmartcols/src/libsmartcols.sym index d599a5030..e7b8f14f3 100644 --- a/libsmartcols/src/libsmartcols.sym +++ b/libsmartcols/src/libsmartcols.sym @@ -145,4 +145,5 @@ global: scols_table_get_termwidth; scols_table_set_termforce; scols_table_set_termwidth; + scols_table_get_name; } SMARTCOLS_2.28; diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c index fcb53b64a..76b6f0b9d 100644 --- a/libsmartcols/src/table.c +++ b/libsmartcols/src/table.c @@ -129,6 +129,19 @@ int scols_table_set_name(struct libscols_table *tb, const char *str) return strdup_to_struct_member(tb, name, str); } +/** + * scols_table_get_name: + * @tb: a pointer to a struct libscols_table instance + * + * Returns: The current name setting of the table @tb + * + * Since: 2.29 + */ +const char *scols_table_get_name(const struct libscols_table *tb) +{ + return tb->name; +} + /** * scols_table_get_title: * @tb: a pointer to a struct libscols_table instance