[MERGED] libosmo-abis[master]: cosmetic: ipa.c: use msgb_dequeue(), drop local var

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Sep 18 22:31:16 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: cosmetic: ipa.c: use msgb_dequeue(), drop local var
......................................................................


cosmetic: ipa.c: use msgb_dequeue(), drop local var

Make ipa_server_conn_write() a lot simpler and shorter by using msgb_dequeue()
and avoiding local pointer that was used only once.

Change-Id: Id968e60d081a6d69de482a908ca3fe5e1044aaa3
---
M src/input/ipa.c
1 file changed, 3 insertions(+), 7 deletions(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/input/ipa.c b/src/input/ipa.c
index ce155ce..fbed038 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -358,20 +358,16 @@
 
 static void ipa_server_conn_write(struct ipa_server_conn *conn)
 {
-	struct osmo_fd *ofd = &conn->ofd;
 	struct msgb *msg;
-	struct llist_head *lh;
 	int ret;
 
 	LOGP(DLINP, LOGL_DEBUG, "sending data\n");
+	msg = msgb_dequeue(&conn->tx_queue);
 
-	if (llist_empty(&conn->tx_queue)) {
-		ofd->when &= ~BSC_FD_WRITE;
+	if (!msg) {
+		conn->ofd.when &= ~BSC_FD_WRITE;
 		return;
 	}
-	lh = conn->tx_queue.next;
-	llist_del(lh);
-	msg = llist_entry(lh, struct msgb, list);
 
 	ret = send(conn->ofd.fd, msg->data, msg->len, 0);
 	if (ret < 0) {

-- 
To view, visit https://gerrit.osmocom.org/3942
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id968e60d081a6d69de482a908ca3fe5e1044aaa3
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list