Change in libosmocore[master]: gprs_ns2: convert gprs_ns2_cause_str into an static inline

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Tue Oct 27 15:31:43 UTC 2020


lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/20937 )

Change subject: gprs_ns2: convert gprs_ns2_cause_str into an static inline
......................................................................

gprs_ns2: convert gprs_ns2_cause_str into an static inline

Be consistent with other implementation of get_value_string() in
libosomocore.

Change-Id: Ic79757df8683e0461c04f7ef9279e4fe645eb821
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2.c
M src/gb/libosmogb.map
3 files changed, 9 insertions(+), 10 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved



diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index 975ddcb..ffc2ad8 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -7,6 +7,7 @@
 #include <netinet/in.h>
 
 #include <osmocom/core/prim.h>
+#include <osmocom/gprs/protocol/gsm_08_16.h>
 
 struct osmo_sockaddr;
 struct osmo_sockaddr_str;
@@ -74,6 +75,12 @@
 	NS_ENDPOINT_CONFIRM_CHANGE,
 };
 
+extern const struct value_string gprs_ns2_cause_strs[];
+
+/*! Obtain a human-readable string for NS primitives */
+static inline const char *gprs_ns2_cause_str(enum ns_cause val)
+{ return get_value_string(gprs_ns2_cause_strs, val); }
+
 struct osmo_gprs_ns2_prim {
 	struct osmo_prim_hdr oph;
 
@@ -185,7 +192,6 @@
 		struct gprs_ns2_nse *nse,
 		const struct osmo_sockaddr *sockaddr);
 void gprs_ns2_start_alive_all_nsvcs(struct gprs_ns2_nse *nse);
-const char *gprs_ns2_cause_str(int cause);
 const char *gprs_ns2_ll_str(struct gprs_ns2_vc *nsvc);
 char *gprs_ns2_ll_str_buf(char *buf, size_t buf_len, struct gprs_ns2_vc *nsvc);
 char *gprs_ns2_ll_str_c(const void *ctx, struct gprs_ns2_vc *nsvc);
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 6401d77..ffa3135 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -138,7 +138,7 @@
 
 
 /* Section 10.3.2, Table 13 */
-static const struct value_string ns2_cause_str[] = {
+const struct value_string gprs_ns2_cause_strs[] = {
 	{ NS_CAUSE_TRANSIT_FAIL,	"Transit network failure" },
 	{ NS_CAUSE_OM_INTERVENTION, 	"O&M intervention" },
 	{ NS_CAUSE_EQUIP_FAIL,		"Equipment failure" },
@@ -160,13 +160,6 @@
 	{ 0, NULL }
 };
 
-/*! Obtain a human-readable string for NS cause value */
-const char *gprs_ns2_cause_str(int cause)
-{
-	enum ns_cause _cause = cause;
-	return get_value_string(ns2_cause_str, _cause);
-}
-
 static const struct rate_ctr_desc nsvc_ctr_description[] = {
 	{ "packets:in", "Packets at NS Level  ( In)" },
 	{ "packets:out","Packets at NS Level  (Out)" },
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index 9c8e685..3755b4f 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -74,7 +74,7 @@
 
 gprs_ns2_aff_cause_prim_strs;
 gprs_ns2_bind_set_mode;
-gprs_ns2_cause_str;
+gprs_ns2_cause_strs;
 gprs_ns2_create_nse;
 gprs_ns2_dynamic_create_nse;
 gprs_ns2_find_vc_by_sockaddr;

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20937
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ic79757df8683e0461c04f7ef9279e4fe645eb821
Gerrit-Change-Number: 20937
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201027/ae92c0d4/attachment.htm>


More information about the gerrit-log mailing list