aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/gsm/gsm0808_utils.h
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-03-18 18:38:47 +0100
committerHarald Welte <laforge@gnumonks.org>2019-04-10 22:42:32 +0000
commit179f35702ece13f4ab7fd1b331bef664834d8473 (patch)
tree9dad4da8eb773040ea8a2dc096190118f5d2abd6 /include/osmocom/gsm/gsm0808_utils.h
parentd08e9866a5c3da6edda574bbe6d277047d10fded (diff)
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
Diffstat (limited to 'include/osmocom/gsm/gsm0808_utils.h')
-rw-r--r--include/osmocom/gsm/gsm0808_utils.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h
index e246967..47c4e95 100644
--- a/include/osmocom/gsm/gsm0808_utils.h
+++ b/include/osmocom/gsm/gsm0808_utils.h
@@ -70,6 +70,7 @@ struct osmo_lcls {
char *osmo_lcls_dump(const struct osmo_lcls *lcls);
char *osmo_lcls_dump_buf(char *buf, size_t buf_len, const struct osmo_lcls *lcls);
+char *osmo_lcls_dump_c(void *ctx, const struct osmo_lcls *lcls);
char *osmo_gcr_dump(const struct osmo_lcls *lcls);
char *osmo_gcr_dump_buf(char *buf, size_t buf_len, const struct osmo_lcls *lcls);
@@ -79,8 +80,11 @@ static inline const char *gsm0808_cell_id_discr_name(enum CELL_IDENT id_discr)
const char *gsm0808_cell_id_name(const struct gsm0808_cell_id *cid);
const char *gsm0808_cell_id_name2(const struct gsm0808_cell_id *cid);
+char *gsm0808_cell_id_name_buf(char *buf, size_t buflen, const struct gsm0808_cell_id *cid);
+char *gsm0808_cell_id_name_c(const void *ctx, const struct gsm0808_cell_id *cid);
const char *gsm0808_cell_id_list_name(const struct gsm0808_cell_id_list2 *cil);
int gsm0808_cell_id_list_name_buf(char *buf, size_t buflen, const struct gsm0808_cell_id_list2 *cil);
+char *gsm0808_cell_id_list_name_c(const void *ctx, const struct gsm0808_cell_id_list2 *cil);
int gsm0808_cell_id_u_name(char *buf, size_t buflen,
enum CELL_IDENT id_discr, const union gsm0808_cell_id_u *u);
bool gsm0808_cell_ids_match(const struct gsm0808_cell_id *id1, const struct gsm0808_cell_id *id2, bool exact_match);
@@ -254,5 +258,6 @@ static inline uint8_t gsm0808_chosen_channel(enum gsm_chan_t type, enum gsm48_ch
const char *gsm0808_channel_type_name(const struct gsm0808_channel_type *ct);
char *gsm0808_channel_type_name_buf(char *buf, size_t buf_len, const struct gsm0808_channel_type *ct);
+char *gsm0808_channel_type_name_c(const void *ctx, const struct gsm0808_channel_type *ct);
/*! @} */