Change in libosmocore[master]: Move msgb_push helpers to public header

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/.

Max gerrit-no-reply at lists.osmocom.org
Thu Nov 8 12:26:07 UTC 2018


Max has uploaded this change for review. ( https://gerrit.osmocom.org/11679


Change subject: Move msgb_push helpers to public header
......................................................................

Move msgb_push helpers to public header

Both msgb_wrap_with_TL() and msgb_push_TLV1() are generally useful so it
make sense to make the public to facilitate code re-use.

Change-Id: I37e91d031fba28cf1c6735b8069b0265746f55e6
---
M include/osmocom/core/msgb.h
M src/gsm/gsm0480.c
2 files changed, 20 insertions(+), 20 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/11679/1

diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h
index 8843db0..a4ea7a2 100644
--- a/include/osmocom/core/msgb.h
+++ b/include/osmocom/core/msgb.h
@@ -366,6 +366,26 @@
 	osmo_store32be(word, space);
 }
 
+static inline unsigned char *msgb_wrap_with_TL(struct msgb *msgb, uint8_t tag)
+{
+	uint8_t *data = msgb_push(msgb, 2);
+
+	data[0] = tag;
+	data[1] = msgb->len - 2;
+	return data;
+}
+
+static inline unsigned char *msgb_push_TLV1(struct msgb *msgb, uint8_t tag,
+					    uint8_t value)
+{
+	uint8_t *data = msgb_push(msgb, 3);
+
+	data[0] = tag;
+	data[1] = 1;
+	data[2] = value;
+	return data;
+}
+
 /*! remove (pull) a header from the front of the message buffer
  *  \param[in] msgb message buffer
  *  \param[in] len number of octets to be pulled
diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 7756ecb..d399fa7 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -68,26 +68,6 @@
 	{ 0, NULL }
 };
 
-static inline unsigned char *msgb_wrap_with_TL(struct msgb *msgb, uint8_t tag)
-{
-	uint8_t *data = msgb_push(msgb, 2);
-
-	data[0] = tag;
-	data[1] = msgb->len - 2;
-	return data;
-}
-
-static inline unsigned char *msgb_push_TLV1(struct msgb *msgb, uint8_t tag,
-					    uint8_t value)
-{
-	uint8_t *data = msgb_push(msgb, 3);
-
-	data[0] = tag;
-	data[1] = 1;
-	data[2] = value;
-	return data;
-}
-
 static inline unsigned char *msgb_push_NULL(struct msgb *msgb)
 {
 	uint8_t *data = msgb_push(msgb, 2);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I37e91d031fba28cf1c6735b8069b0265746f55e6
Gerrit-Change-Number: 11679
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181108/a00191a0/attachment.htm>


More information about the gerrit-log mailing list