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/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 26f7944..70eed15 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -611,7 +611,7 @@
 	return ret;
 }
 
-static char dbuf[256];
+static __thread char dbuf[256];
 
 /*! Dump LCLS parameters (GCR excluded) into string for printing.
  *  \param[out] buf caller-allocated output string buffer
@@ -1819,7 +1819,7 @@
  */
 const char *gsm0808_cell_id_name(const struct gsm0808_cell_id *cid)
 {
-	static char buf[64];
+	static __thread char buf[64];
 	return gsm0808_cell_id_name_buf(buf, sizeof(buf), cid);
 }
 
@@ -1829,7 +1829,7 @@
  */
 const char *gsm0808_cell_id_name2(const struct gsm0808_cell_id *cid)
 {
-	static char buf[64];
+	static __thread char buf[64];
 	return gsm0808_cell_id_name_buf(buf, sizeof(buf), cid);
 }
 
@@ -1886,7 +1886,7 @@
  * See also gsm0808_cell_id_list_name_buf(). */
 const char *gsm0808_cell_id_list_name(const struct gsm0808_cell_id_list2 *cil)
 {
-	static char buf[1024];
+	static __thread char buf[1024];
 	gsm0808_cell_id_list_name_buf(buf, sizeof(buf), cil);
 	return buf;
 }
@@ -1913,7 +1913,7 @@
 
 const char *gsm0808_channel_type_name(const struct gsm0808_channel_type *ct)
 {
-	static char buf[128];
+	static __thread char buf[128];
 	return gsm0808_channel_type_name_buf(buf, sizeof(buf), ct);
 }