aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-12-16 13:43:54 +0100
committerHarald Welte <laforge@gnumonks.org>2016-12-21 10:37:13 +0000
commit18080960e1f85bb315d927d18e52656973834813 (patch)
tree8afb5e09cfcfb74390d3fdaa37a8ca5a4ee33bc5 /src
parent4e72ee0d0f678ec91dee5ad33e8796b56e8c078d (diff)
utils.h: add OSMO_STRINGIFY and OSMO_VALUE_STRING macros
OSMO_STRINGIFY particularly allows putting port numbers from a #define into VTY doc strings, like: #define FOO_PORT 2342 DEFUN(..., "Foo UDP port (default: " OSMO_STRINGIFY(FOO_PORT) ")\n") OSMO_VALUE_STRING creates value_string items with the string being exactly the enum value's name. Replaces a similar macro def in fsm.c Change-Id: I857af45ae602bb9a647ba26cf8b0d1b23403b54c
Diffstat (limited to 'src')
-rw-r--r--src/fsm.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/fsm.c b/src/fsm.c
index 16699fab..842c7665 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -476,14 +476,12 @@ void _osmo_fsm_inst_term(struct osmo_fsm_inst *fi,
file, line);
}
-#define ENUM_VAL_TO_VALUE_STRING(X) { X, #X }
-
const struct value_string osmo_fsm_term_cause_names[] = {
- ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_PARENT),
- ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REQUEST),
- ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REGULAR),
- ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_ERROR),
- ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_TIMEOUT),
+ OSMO_VALUE_STRING(OSMO_FSM_TERM_PARENT),
+ OSMO_VALUE_STRING(OSMO_FSM_TERM_REQUEST),
+ OSMO_VALUE_STRING(OSMO_FSM_TERM_REGULAR),
+ OSMO_VALUE_STRING(OSMO_FSM_TERM_ERROR),
+ OSMO_VALUE_STRING(OSMO_FSM_TERM_TIMEOUT),
{ 0, NULL }
};