aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-01-09 17:11:50 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-01-11 18:11:13 +0100
commit4babba62b85192473f3545fa2bb7b6b1a4e66c50 (patch)
tree3e4b2ce7e769f7a802c53581306af8aa62fd9cd7
parent3749dc93a3e0ab9a2e4c19f42f7879a80265621e (diff)
ctrl: Work on the cmd->node instead of the data pointer passed
Make the macros use the cmd->node instead of the data pointer. The naming of the variable inside the macro already indicates that it should use the nodes data structure.
-rw-r--r--openbsc/include/openbsc/control_cmd.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h
index 57785b87f..ba18ad8f5 100644
--- a/openbsc/include/openbsc/control_cmd.h
+++ b/openbsc/include/openbsc/control_cmd.h
@@ -87,9 +87,9 @@ struct ctrl_cmd *ctrl_cmd_create(void *ctx, enum ctrl_type);
struct ctrl_cmd *ctrl_cmd_trap(struct ctrl_cmd *cmd);
#define CTRL_CMD_DEFINE_RANGE(cmdname, cmdstr, dtype, element, min, max) \
-static int get_##cmdname(struct ctrl_cmd *cmd, void *data) \
+static int get_##cmdname(struct ctrl_cmd *cmd, void *_data) \
{ \
- dtype *node = data; \
+ dtype *node = cmd->node; \
cmd->reply = talloc_asprintf(cmd, "%i", node->element); \
if (!cmd->reply) { \
cmd->reply = "OOM"; \
@@ -97,14 +97,14 @@ static int get_##cmdname(struct ctrl_cmd *cmd, void *data) \
} \
return CTRL_CMD_REPLY; \
} \
-static int set_##cmdname(struct ctrl_cmd *cmd, void *data) \
+static int set_##cmdname(struct ctrl_cmd *cmd, void *_data) \
{ \
- dtype *node = data; \
+ dtype *node = cmd->node; \
int tmp = atoi(cmd->value); \
node->element = tmp; \
- return get_##cmdname(cmd, data); \
+ return get_##cmdname(cmd, _data); \
} \
-static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data) \
+static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *_data) \
{ \
int tmp = atoi(value); \
if ((tmp >= min)&&(tmp <= max)) { \
@@ -123,7 +123,7 @@ struct ctrl_cmd_element cmd_##cmdname = { \
#define CTRL_CMD_DEFINE_STRING(cmdname, cmdstr, dtype, element) \
static int get_##cmdname(struct ctrl_cmd *cmd, void *_data) \
{ \
- dtype *data = _data; \
+ dtype *data = cmd->node; \
cmd->reply = talloc_asprintf(cmd, "%s", data->element); \
if (!cmd->reply) { \
cmd->reply = "OOM"; \
@@ -133,9 +133,9 @@ static int get_##cmdname(struct ctrl_cmd *cmd, void *_data) \
} \
static int set_##cmdname(struct ctrl_cmd *cmd, void *_data) \
{ \
- dtype *data = _data; \
+ dtype *data = cmd->node; \
bsc_replace_string(cmd->node, &data->element, cmd->value); \
- return get_##cmdname(cmd, data); \
+ return get_##cmdname(cmd, _data); \
} \
struct ctrl_cmd_element cmd_##cmdname = { \
.name = cmdstr, \