fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29440 )
Change subject: llc: re-define value-string API as static inline functions ......................................................................
llc: re-define value-string API as static inline functions
Using static inline functions allows for type checking at compile-time.
Change-Id: I1b3245f62f5182aa91dbad7958d89220f7107337 Fixes: I6d0e1a878fb80c57a901da08798620a6ea4471a4 --- M include/osmocom/gprs/llc/llc.h 1 file changed, 8 insertions(+), 4 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved
diff --git a/include/osmocom/gprs/llc/llc.h b/include/osmocom/gprs/llc/llc.h index b035acc..aa11634 100644 --- a/include/osmocom/gprs/llc/llc.h +++ b/include/osmocom/gprs/llc/llc.h @@ -27,8 +27,10 @@
extern const struct value_string osmo_gprs_llc_frame_fmt_names[];
-#define osmo_gprs_llc_frame_fmt_name(val) \ - get_value_string(osmo_gprs_llc_frame_fmt_names, val) +static inline const char *osmo_gprs_llc_frame_fmt_name(enum osmo_gprs_llc_frame_fmt val) +{ + return get_value_string(osmo_gprs_llc_frame_fmt_names, val); +}
/* Section 6.4 Commands and responses */ enum osmo_gprs_llc_frame_func { @@ -52,8 +54,10 @@
extern const struct value_string osmo_gprs_llc_frame_func_names[];
-#define osmo_gprs_llc_frame_func_name(val) \ - get_value_string(osmo_gprs_llc_frame_func_names, val) +static inline const char *osmo_gprs_llc_frame_func_name(enum osmo_gprs_llc_frame_func val) +{ + return get_value_string(osmo_gprs_llc_frame_func_names, val); +}
/* Section 6.4.1.6 / Table 6 */ enum osmo_gprs_llc_xid_type {