From f3c7e85d05f7b2b7bf093162b776f71b2bc6420d Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 20 Aug 2014 22:50:47 +0200 Subject: libctrl: remove reference to bsc_replace_string() ... and rather introduce a general osmo_talloc_replace_string() to libosmocore. --- include/osmocom/core/utils.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/osmocom/core/utils.h') 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 +#include /*! \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); +} /*! @} */ -- cgit v1.2.3