summaryrefslogtreecommitdiff
path: root/include/list.h
AgeCommit message (Collapse)AuthorFilesLines
2013-01-08include: cleanup copyright headersKarel Zak1-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>
2012-12-18include/list: add list_last_entry()Karel Zak1-2/+5
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-17include/list: fix undefined behavior in list_entry() macroSami Liedes1-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>
2012-06-11include: fix spurious list.h warningsSami Kerola1-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>
2012-03-09libmount: fix "already mounted" detection on systems with mtabKarel Zak1-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>
2011-12-16lists: add list sorting routineDavidlohr Bueso1-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>
2011-01-14include: fix list.h ifdefsKarel Zak1-3/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-03include: move shlibs/.../list.h to the include/ directoryKarel Zak1-0/+197
Signed-off-by: Karel Zak <kzak@redhat.com>