libudev/strbuf.c: remove usage of glibc-internal __compar_fn_t

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
libudev/path-util.c: remove usage of canonicalize_file_name()

this is a glibc specific alias for realpath(path, NULL).
to be portable, we need to use the real thing which is even less
verbose.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
libudev/log.c: using strlen without including string.h is no good idea

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
fix usage of glibc-specific sys/poll.h

sys/poll.h is a legacy alias used by glibc.
according to POSIX #include <poll.h> is correct.
on GLIBC, the POSIX header includes sys/poll.h, so everything
continues working as it should.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
libudev/sparse-endian.h: include header which defines __bswap_XX

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev/udevadm-hwdb.c: remove usage of qsort_r

while theoretically a nice interface, qsort_r on GLIBC was
implemented with a prototype that shuffles the argument order
around when compared to the traditional BSD implementations,
yielding in 2 separate incompatible implementations.
even worse, the arguments are all of pointer type so one would
not even notice that the order is wrong and so this would yield
in crashes or silent memory corruption.
thus musl does not implement it, because configure scripts would
check for its existance and use it unconditionally, even when
assuming the BSD version.

a more portable solution is to use TLS via __thread, which any
modern GCC should provide. (even 3.4.6 on x86/x86_64 does so).

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>