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/gsm23003.c b/src/gsm/gsm23003.c
index a97ed07..4cc2671 100644
--- a/src/gsm/gsm23003.c
+++ b/src/gsm/gsm23003.c
@@ -107,7 +107,7 @@
  */
 const char *osmo_mcc_name(uint16_t mcc)
 {
-	static char buf[8];
+	static __thread char buf[8];
 	return osmo_mcc_name_buf(buf, sizeof(buf), mcc);
 }
 
@@ -158,7 +158,7 @@
  */
 const char *osmo_mnc_name(uint16_t mnc, bool mnc_3_digits)
 {
-	static char buf[8];
+	static __thread char buf[8];
 	return osmo_mnc_name_buf(buf, sizeof(buf), mnc, mnc_3_digits);
 }
 
@@ -182,7 +182,7 @@
  */
 const char *osmo_plmn_name(const struct osmo_plmn_id *plmn)
 {
-	static char buf[16];
+	static __thread char buf[16];
 	return osmo_plmn_name_buf(buf, sizeof(buf), plmn);
 }
 
@@ -193,7 +193,7 @@
  */
 const char *osmo_plmn_name2(const struct osmo_plmn_id *plmn)
 {
-	static char buf[16];
+	static __thread char buf[16];
 	return osmo_plmn_name_buf(buf, sizeof(buf), plmn);
 }
 
@@ -230,7 +230,7 @@
  */
 const char *osmo_lai_name(const struct osmo_location_area_id *lai)
 {
-	static char buf[32];
+	static __thread char buf[32];
 	return osmo_lai_name_buf(buf, sizeof(buf), lai);
 }
 
@@ -265,7 +265,7 @@
  */
 const char *osmo_cgi_name(const struct osmo_cell_global_id *cgi)
 {
-	static char buf[32];
+	static __thread char buf[32];
 	return osmo_cgi_name_buf(buf, sizeof(buf), cgi);
 }
 
@@ -276,7 +276,7 @@
  */
 const char *osmo_cgi_name2(const struct osmo_cell_global_id *cgi)
 {
-	static char buf[32];
+	static __thread char buf[32];
 	return osmo_cgi_name_buf(buf, sizeof(buf), cgi);
 }
 
@@ -320,7 +320,7 @@
  */
 const char *osmo_gummei_name(const struct osmo_gummei *gummei)
 {
-	static char buf[32];
+	static __thread char buf[32];
 	return osmo_gummei_name_buf(buf, sizeof(buf), gummei);
 }