}
/**
- * list_last_entry - tests whether is entry last in the list
+ * list_entry_is_last - tests whether is entry last in the list
* @entry: the entry to test.
* @head: the list to test.
*/
-_INLINE_ int list_last_entry(struct list_head *entry, struct list_head *head)
+_INLINE_ int list_entry_is_last(struct list_head *entry, struct list_head *head)
{
return head->prev == entry;
}
#define list_first_entry(head, type, member) \
((head) && (head)->next != (head) ? list_entry((head)->next, type, member) : NULL)
+#define list_last_entry(head, type, member) \
+ ((head) && (head)->prev != (head) ? list_entry((head)->prev, type, member) : NULL)
+
/**
* list_for_each - iterate over elements in a list
* @pos: the &struct list_head to use as a loop counter.
#endif /* !HAVE_WIDECHAR */
#define is_last_column(_tb, _cl) \
- list_last_entry(&(_cl)->cl_columns, &(_tb)->tb_columns)
+ list_entry_is_last(&(_cl)->cl_columns, &(_tb)->tb_columns)
/*
* Counts number of cells in multibyte string. For all control and
if (!buf)
return NULL;
- if (list_last_entry(&ln->ln_children, &ln->parent->ln_branch))
+ if (list_entry_is_last(&ln->ln_children, &ln->parent->ln_branch))
art = " ";
else
art = ln->table->symbols->vert;
if (!ln->parent)
snprintf(p, bufsz, "%s", data); /* root node */
- else if (list_last_entry(&ln->ln_children, &ln->parent->ln_branch))
+ else if (list_entry_is_last(&ln->ln_children, &ln->parent->ln_branch))
snprintf(p, bufsz, "%s%s", sym->right, data); /* last chaild */
else
snprintf(p, bufsz, "%s%s", sym->branch, data); /* any child */