mirror of https://gerrit.osmocom.org/libosmocore
libctrl: remove reference to bsc_replace_string()
... and rather introduce a general osmo_talloc_replace_string() to libosmocore.
This commit is contained in:
parent
c9df37d84a
commit
f3c7e85d05
|
@ -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);
|
||||
}
|
||||
|
||||
/*! @} */
|
||||
|
|
|
@ -145,7 +145,7 @@ static int get_##cmdname(struct ctrl_cmd *cmd, void *_data) \
|
|||
static int set_##cmdname(struct ctrl_cmd *cmd, void *_data) \
|
||||
{ \
|
||||
dtype *data = cmd->node; \
|
||||
bsc_replace_string(cmd->node, &data->element, cmd->value); \
|
||||
osmo_talloc_replace_string(cmd->node, &data->element, cmd->value); \
|
||||
return get_##cmdname(cmd, _data); \
|
||||
}
|
||||
#define CTRL_CMD_DEFINE_STRING(cmdname, cmdstr, dtype, element) \
|
||||
|
|
Loading…
Reference in New Issue