htable: add FOREACH macro

Allow iterating over a htable easily with a macro. This is slightly slower
than shl_htable_visit() but what do you expect if you linearly iterate
over a set of data..

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
htable: add FIRST accessor

The SHL_HTABLE_FIRST() macro returns the first element of a hash-table.
Hash-tables are sorted randomly, so callers should expect a random element
to be returned.

A test-case is added which shows a usual workflow for this:
  while ((i = SHL_HTABLE_FIRST(ht)))
    destroy(i);

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
htable: support NULL strings just fine

Allow inserting NULL strings if the *_str variant of htable is used. This
simplifies error-paths significantly.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
util: add shl_startswith() helper

This helper test whether a given string has a specified prefix. We mark
the helper as "static inline" in the header so strlen() can use sizeof()
if the size is known at compile-time.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
util: add shl_qstr_* helpers

The qstr helpers can be used to decode and tokenize quoted and escaped
strings.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
macro/util: add _cleanup_ helpers

Some cleanup helpers for common tasks.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
util: add _shl_sentinel_ to shl_strjoin()

Add sentinel marker so gcc warns if the sentinel (NULL) is omitted. Very
handy to catch bugs early during compilation.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>