aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/utils.h
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2014-08-20 22:50:47 +0200
committerHarald Welte <laforge@gnumonks.org>2014-08-21 15:34:17 +0200
commitf3c7e85d05f7b2b7bf093162b776f71b2bc6420d (patch)
tree9c2e543dd52863075e39fa4f5961cd16a98df5a5 /include/osmocom/core/utils.h
parentc9df37d84a7a9bace75cc0549a21fdcd9b178182 (diff)
libctrl: remove reference to bsc_replace_string()
... and rather introduce a general osmo_talloc_replace_string() to libosmocore.
Diffstat (limited to 'include/osmocom/core/utils.h')
-rw-r--r--include/osmocom/core/utils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index c08e7753..373522ac 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -1,6 +1,7 @@
#pragma once
#include <osmocom/core/backtrace.h>
+#include <osmocom/core/talloc.h>
/*! \defgroup utils General-purpose utility functions
* @{
@@ -59,5 +60,11 @@ do { \
abort(); \
}
+static inline void osmo_talloc_replace_string(void *ctx, char **dst, char *newstr)
+{
+ if (*dst)
+ talloc_free(*dst);
+ *dst = talloc_strdup(ctx, newstr);
+}
/*! @} */