Add _c versions of functions that otherwise return static buffers

We have a habit of returning static buffers from some functions,
particularly when generating some kind of string values.  This is
convenient in terms of memory management, but it comes at the expense
of not being thread-safe, and not allowing for two calls of the
related function within one printf() statement.

Let's introduce _c suffix versions of those functions where the
caller passes in a talloc context from which the output buffer shall
be allocated.

Change-Id: I8481c19b68ff67cfa22abb93c405ebcfcb0ab19b
diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c
index e25fdd0..a4c0e41 100644
--- a/src/gsm/abis_nm.c
+++ b/src/gsm/abis_nm.c
@@ -943,6 +943,15 @@
 	return abis_nm_dump_foh_buf(foh_buf, sizeof(foh_buf), foh);
 }
 
+char *abis_nm_dump_foh_c(void *ctx, const struct abis_om_fom_hdr *foh)
+{
+	size_t len = 15 /* format */ + 22 /* obj_class_name */+ 4*3 /* uint8 */ + 1 /*nul*/;
+	char *buf = talloc_size(ctx, len);
+	if (!buf)
+		return NULL;
+	return abis_nm_dump_foh_buf(buf, len, foh);
+}
+
 /* this is just for compatibility reasons, it is now a macro */
 #undef abis_nm_debugp_foh
 OSMO_DEPRECATED("Use abis_nm_debugp_foh macro instead")