summaryrefslogtreecommitdiffstats
path: root/include/list.h
Commit message (Collapse)AuthorAgeFilesLines
* include/list: add list_entry_is_first() and list_count_entries()Karel Zak2018-12-071-0/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/list, include/c: update and container_of()Karel Zak2018-07-201-4/+3Star
| | | | | | | | * update container_of() to version without "const" qualifier * use container_of() in list_entry() Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/list: remove LIST_HEAD macroKarel Zak2017-01-051-5/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | * the variable definition with hidden type is always horrible, for example: int func() { LIST_HEAD(foo); ... } the more readable is: int func() { struct list_head foo; INIT_LIST_HEAD(&foo); ... } * the name LIST_HEAD conflict with /usr/include/sys/queue.h * we use it only on two places in sulogin Signed-off-by: Karel Zak <kzak@redhat.com>
* include: fix compiler warningsSami Kerola2014-10-011-1/+1
| | | | | | | | | | | | | | | | | This change has motivation to make -Wall -pedantic compiler options to spit a little bit less noise, which with luck will increase change to notice real issues. Multiple of these: warning: ISO C forbids braced-groups within expressions [-Wpedantic] And nearly 300 times reported: include/c.h:75:41: warning: struct has no named members [-Wpedantic] #define UL_BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include/list: add void data to the sort cmp functionKarel Zak2014-03-111-9/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include: cleanup copyright headersKarel Zak2013-01-081-0/+3
| | | | | | | We use the code from include/ and lib/ on many places, so use public domain if possible or LGPL for code copied from libs. Signed-off-by: Karel Zak <kzak@redhat.com>
* include/list: add list_last_entry()Karel Zak2012-12-181-2/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/list: fix undefined behavior in list_entry() macroSami Liedes2012-12-171-2/+3
| | | | | | | | | | | | | Update list_entry() macro, which is basically the same as the container_of() macro in the kernel, to use offsetof() to fix undefined behavior. Caught using clang -fsanitize=undefined. [kzak@redhat.com: port from e2fsprogs] Signed-off-by: Sami Liedes <sami.liedes@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* include: fix spurious list.h warningsSami Kerola2012-06-111-2/+2
| | | | | | | | | include/list.h:224:17: warning: ISO C forbids omitting the middle term of a ?: expression [-pedantic] include/list.h:255:19: warning: ISO C forbids omitting the middle term of a ?: expression [-pedantic] Compilation warned about that at least 110 times. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: fix "already mounted" detection on systems with mtabKarel Zak2012-03-091-0/+4
| | | | | | | | For systems with regular mtab the fs->root should be ignored in "already mounted" heuristic. Reported-by: Matt Burgess <matthew@linuxfromscratch.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* lists: add list sorting routineDavidlohr Bueso2011-12-161-0/+132
| | | | | | | | | | | | | | | | | We need a list sorting function, just to mention one example user that could benefit is the lib/tt code to sort columns. This patch adds list_sort() which uses the Merge Sort algorithm, behaving nicely in O(nlog(n)), heavily based on the kernel's implementation[1]. The private data (void *priv) passed to the comparison function as been removed to adopt a qsort(3)-like syntax, and IMHO we don't really need it anyways. [1]: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=lib/list_sort.c;h=d7325c6b103f0be078ff3672c35c468ed35738f1;hb=HEAD [kzak@redhat.com: - use size_t in list_sort()] Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* include: fix list.h ifdefsKarel Zak2011-01-141-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include: move shlibs/.../list.h to the include/ directoryKarel Zak2010-06-031-0/+197
Signed-off-by: Karel Zak <kzak@redhat.com>