summaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-01-09 16:54:49 +0100
committerHarald Welte <laforge@gnumonks.org>2014-08-21 15:34:15 +0200
commit43a11db87998add9132f1bfbe41e3369bb0a7e5f (patch)
tree218679c32f9e1e390aa1ddfab2ce172ae2c2cfe1 /openbsc
parent9c97493c5c90d7c81a11cf28965fd513f665d1cd (diff)
ctrl: Fix the signature of the string control commands
Like with all type unsafe callbacks we will need to cast from void to the dtype. This addresses some compiler warnings. Make it possible to only include the control_cmd.h to use the macros defined in this file.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/control_cmd.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h
index 3dc5b546..57785b87 100644
--- a/openbsc/include/openbsc/control_cmd.h
+++ b/openbsc/include/openbsc/control_cmd.h
@@ -2,10 +2,13 @@
#define _CONTROL_CMD_H
#include <osmocom/core/msgb.h>
+#include <osmocom/core/talloc.h>
#include <osmocom/core/write_queue.h>
#include <osmocom/vty/vector.h>
+#include <openbsc/vty.h>
+
#define CTRL_CMD_ERROR -1
#define CTRL_CMD_HANDLED 0
#define CTRL_CMD_REPLY 1
@@ -118,8 +121,9 @@ struct ctrl_cmd_element cmd_##cmdname = { \
}
#define CTRL_CMD_DEFINE_STRING(cmdname, cmdstr, dtype, element) \
-static int get_##cmdname(struct ctrl_cmd *cmd, dtype *data) \
+static int get_##cmdname(struct ctrl_cmd *cmd, void *_data) \
{ \
+ dtype *data = _data; \
cmd->reply = talloc_asprintf(cmd, "%s", data->element); \
if (!cmd->reply) { \
cmd->reply = "OOM"; \
@@ -127,8 +131,9 @@ static int get_##cmdname(struct ctrl_cmd *cmd, dtype *data) \
} \
return CTRL_CMD_REPLY; \
} \
-static int set_##cmdname(struct ctrl_cmd *cmd, dtype *data) \
+static int set_##cmdname(struct ctrl_cmd *cmd, void *_data) \
{ \
+ dtype *data = _data; \
bsc_replace_string(cmd->node, &data->element, cmd->value); \
return get_##cmdname(cmd, data); \
} \