util: when using basename() for creating temporary files, verify the resulting name is actually valid

Also, rename filename_is_safe() to filename_is_valid(), since it
actually does a full validation for what the kernel will accept as file
name, it's not just a heuristic.

NOTE: eudev doesn't have filename_is_safe() -- AGB

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
util: minor simplification for loop_write() and loop_read()

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
src/shared/util.c: follow upstream on tempfn_xxxxxx()

Upstream change the behaviour of tempfn_xxxxxx() to make
the following work:

    # systemd-nspawn -xb -D / -M foobar

in commit c4e34a612c81266773cf8358cb38a43d2e43474e.  We
have no reason not to follow that change even though
eudev has nothing to do with nspawn.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
shared/hashmap.h: fix comment

An early version used underscore prefixes for internal functions, but
the current version uses the prefix "internal_".

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
src/shared/utf8.c: follow upstream adding utf8_encode_unichar()

This is part of upstream's e7eebcfc42f00aa481ef31abc8e7e243c16f5b2c
in which they add a minimal JSON tokenizer.  We don't add that but
update utf8 stuff from that commit to follow upstream more closely.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
configure.ac: add a generic --enable-debug, replace --enable-hashmap-debug

There will be more debugging options later.
 --enable-debug will enable them all.
 --enable-debug=hashmap will enable only hashmap debugging.

Also rename the C #define to ENABLE_DEBUG_* pattern.

NOTE: We add the debugging code to hashmap.{c,h} but do not
add the option in configure.ac.  We may do so at a later time.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
src/shared/util.c: fix tempfn_xxxxxx()

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