summaryrefslogtreecommitdiff
path: root/ui.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2017-01-17 14:11:31 +0100
committerTobias Klauser <tklauser@distanz.ch>2017-01-17 14:27:06 +0100
commita1351738ba11c8e2d38f6df5276cc59f7acb2d2f (patch)
treefdcc605e39a4ddec3d42921241f6d03ec461cf59 /ui.c
parent80e70fdcf8861ab757b6bfc8f0fbaec31cde57bf (diff)
list: Remove cds_list_* wrappers
Use the cds_list_* types and macros directly instead of redefining them. This makes it clear that we're not using the Linux kernel implementation of list_head but the one from urcu. Also make sure _LGPL_SOURCE is defined everywhere the urcu functionality is used, such that we get the statically linkable version with reduced overhead. Reference: https://lwn.net/Articles/573424/#qq2answer Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/ui.c b/ui.c
index 2177964..78d1560 100644
--- a/ui.c
+++ b/ui.c
@@ -63,14 +63,14 @@ void ui_table_init(struct ui_table *tbl)
tbl->col_pad = 1;
tbl->row = ui_text_alloc(tbl->width);
- INIT_LIST_HEAD(&tbl->cols);
+ CDS_INIT_LIST_HEAD(&tbl->cols);
}
void ui_table_uninit(struct ui_table *tbl)
{
struct ui_col *col, *tmp;
- list_for_each_entry_safe(col, tmp, &tbl->cols, entry)
+ cds_list_for_each_entry_safe(col, tmp, &tbl->cols, entry)
xfree(col);
ui_text_free(tbl->row);
@@ -87,7 +87,7 @@ static struct ui_col *ui_table_col_get(struct ui_table *tbl, uint32_t id)
{
struct ui_col *col;
- list_for_each_entry(col, &tbl->cols, entry) {
+ cds_list_for_each_entry(col, &tbl->cols, entry) {
if (col->id == id)
return col;
}
@@ -100,7 +100,7 @@ static void __ui_table_pos_update(struct ui_table *tbl)
struct ui_col *col;
uint32_t pos = 0;
- list_for_each_entry(col, &tbl->cols, entry) {
+ cds_list_for_each_entry(col, &tbl->cols, entry) {
col->pos = pos;
pos += col->len + tbl->col_pad;
}
@@ -115,7 +115,7 @@ void ui_table_col_add(struct ui_table *tbl, uint32_t id, char *name, uint32_t le
col->len = len;
col->align = UI_ALIGN_LEFT;
- list_add_tail(&col->entry, &tbl->cols);
+ cds_list_add_tail(&col->entry, &tbl->cols);
__ui_table_pos_update(tbl);
}
@@ -195,9 +195,8 @@ void ui_table_header_print(struct ui_table *tbl)
mvprintw(tbl->y, tbl->x, "%*s", tbl->width, " ");
attroff(tbl->hdr_color);
- list_for_each_entry(col, &tbl->cols, entry) {
+ cds_list_for_each_entry(col, &tbl->cols, entry) {
__ui_table_row_print(tbl, col, tbl->hdr_color, col->name);
-
}
ui_table_row_show(tbl);