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/gsm48.c b/src/gsm/gsm48.c
index c2c19cf..c97337b 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -203,7 +203,7 @@
  */
 const char *osmo_rai_name(const struct gprs_ra_id *rai)
 {
-	static char buf[32];
+	static __thread char buf[32];
 	return osmo_rai_name_buf(buf, sizeof(buf), rai);
 }
 
@@ -502,7 +502,7 @@
  */
 const char *osmo_mi_name(const uint8_t *mi, uint8_t mi_len)
 {
-	static char mi_name[10 + GSM48_MI_SIZE + 1];
+	static __thread char mi_name[10 + GSM48_MI_SIZE + 1];
 	return osmo_mi_name_buf(mi_name, sizeof(mi_name), mi, mi_len);
 }
 
@@ -1150,7 +1150,7 @@
  */
 const char *gsm48_pdisc_msgtype_name(uint8_t pdisc, uint8_t msg_type)
 {
-	static char namebuf[64];
+	static __thread char namebuf[64];
 	return gsm48_pdisc_msgtype_name_buf(namebuf, sizeof(namebuf), pdisc, msg_type);
 }
 
@@ -1303,7 +1303,7 @@
  */
 const char *osmo_gsm48_classmark_a5_name(const struct osmo_gsm48_classmark *cm)
 {
-	static char buf[128];
+	static __thread char buf[128];
 	return osmo_gsm48_classmark_a5_name_buf(buf, sizeof(buf), cm);
 }