make all library-internal static buffers thread-local

We have a number of library-internal static global buffers which are
mainly used for various stringification functions.  This worked as
all of the related Osmocom programs were strictly single-threaded.

Let's make those buffers at least thread-local.  This way every thread
gets their own set of buffers, and it's safe for multiple threads to
execute the same functions once.  They're of course still not
re-entrant.  If you need re-entrancy, you will need to use the _c()
or _buf() suffix version of those functions and work with your own
(stack or heap) buffers.

Change-Id: I50eb2436a7c1261d79a9d2955584dce92780ca07
diff --git a/src/gsm/apn.c b/src/gsm/apn.c
index 88b45a4..a7074ea 100644
--- a/src/gsm/apn.c
+++ b/src/gsm/apn.c
@@ -31,7 +31,7 @@
 #define APN_OI_GPRS_FMT	"mnc%03u.mcc%03u.gprs"
 #define APN_GPRS_FMT	"%s.mnc%03u.mcc%03u.gprs"
 
-static char apn_strbuf[APN_MAXLEN+1];
+static __thread char apn_strbuf[APN_MAXLEN+1];
 
 char *osmo_apn_qualify_buf(char *buf, size_t buf_len, unsigned int mcc, unsigned int mnc, const char *ni)
 {