utils: fix OSMO_STRBUF_REMAIN to handle sb.pos == NULL correctly

Currently, OSMO_STRBUF_REMAIN would return a huge number if the given
strbuf has its .pos pointer set to NULL.  This macro is safe against
the .buf pointer being NULL, but not against .pos being NULL.

Fix this by adding a static inline function (for the sake of code
readability) and handle .pos being NULL properly by returning length
of the buffer.  Add a unit test.

Change-Id: I294a74a99c40995cf7fb5520d61f697d967be5a4
diff --git a/tests/utils/utils_test.ok b/tests/utils/utils_test.ok
index 6f5d46b..c0c9560 100644
--- a/tests/utils/utils_test.ok
+++ b/tests/utils/utils_test.ok
@@ -524,6 +524,13 @@
 6: "" sb.chars_needed=6 sb.pos=&sb.buf[1]
 7: "" sb.chars_needed=12 sb.pos=&sb.buf[1]
 
+strbuf_test_remain_char_count
+remaining space: 20
+current char count: 0
+populating the buffer
+remaining space: 13
+current char count: 7
+
 startswith_test()
 osmo_str_startswith(NULL, NULL) == true
 osmo_str_startswith("", NULL) == true