aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-09 23:01:37 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-15 13:54:26 +0000
commit8a5d60b996f0c653787baa9954a8b3d57f542324 (patch)
tree45d09686d6f353f3563b21ab6f25353330732cb4
parent7c1ec8c8e763f9ab59f0de3ee25d2cd325d7480e (diff)
fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY()
To be able to use OSMO_VALUE_STRING() on a #defined constant, don't use OSMO_STRINGIFY(): the second indirection resolves the #define to its value, so for example OSMO_VALUE_STRING(GSM48_PDISC_MM) would resolve to { 0x05, "0x05" } When using '#x' directly, this becomes the desired { 0x05, "GSM48_PDISC_MM" } With enum values as we've used until now, this problem does not appear, because enum values are not resolved by the preprocessor. Keep OSMO_STRINGIFY() because it is used directly in openbsc (composing FSM state names). Change-Id: I91ecfcef61be8cf73d59ea821cc4fd9d2ad5c9c7
-rw-r--r--include/osmocom/core/utils.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index d9c3097f..63a73ab4 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -18,7 +18,7 @@
/*! \brief Stringify the contents of a macro, e.g. a port number */
#define OSMO_STRINGIFY(x) #x
/*! \brief Make a value_string entry from an enum value name */
-#define OSMO_VALUE_STRING(x) { x, OSMO_STRINGIFY(x) }
+#define OSMO_VALUE_STRING(x) { x, #x }
#include <stdint.h>
#include <stdio.h>