[sr-dev] git:master:d33e8efc: mqueu: Convert items to single linked list

Alex Hermann alex at speakup.nl
Tue Aug 30 13:51:39 CEST 2016


Module: kamailio
Branch: master
Commit: d33e8efc93446c1d5a092740b5a2387dea5de1fc
URL: https://github.com/kamailio/kamailio/commit/d33e8efc93446c1d5a092740b5a2387dea5de1fc

Author: Alex Hermann <alex at speakup.nl>
Committer: Alex Hermann <alex at speakup.nl>
Date: 2016-08-02T12:47:23+02:00

mqueu: Convert items to single linked list

The doubly-lined feature is not used as the prev attribute was write-only-memory.

---

Modified: modules/mqueue/mqueue_api.c

---

Diff:  https://github.com/kamailio/kamailio/commit/d33e8efc93446c1d5a092740b5a2387dea5de1fc.diff
Patch: https://github.com/kamailio/kamailio/commit/d33e8efc93446c1d5a092740b5a2387dea5de1fc.patch

---

diff --git a/modules/mqueue/mqueue_api.c b/modules/mqueue/mqueue_api.c
index d9a8536..85ddf7e 100644
--- a/modules/mqueue/mqueue_api.c
+++ b/modules/mqueue/mqueue_api.c
@@ -44,7 +44,6 @@ typedef struct _mq_item
 {
 	str key;
 	str val;
-	struct _mq_item *prev;
 	struct _mq_item *next;
 } mq_item_t;
 
@@ -266,8 +265,6 @@ int mq_head_fetch(str *name)
 	mh->ifirst = mh->ifirst->next;
 	if(mh->ifirst==NULL) {
 		mh->ilast = NULL;
-	} else {
-		mh->ifirst->prev = NULL;
 	}
 	mh->csize--;
 
@@ -332,7 +329,6 @@ int mq_item_add(str *qname, str *key, str *val)
 		mh->ilast = mi;
 	} else {
 		mh->ilast->next = mi;
-		mi->prev = mh->ilast;
 		mh->ilast = mi;
 	}
 	mh->csize++;
@@ -341,9 +337,9 @@ int mq_item_add(str *qname, str *key, str *val)
 		mi = mh->ifirst;
 		mh->ifirst = mh->ifirst->next;
 		if(mh->ifirst==NULL)
+		{
 			mh->ilast = NULL;
-		else
-			mh->ifirst->prev = NULL;
+		}
 		mh->csize--;
 		shm_free(mi);
 	}




More information about the sr-dev mailing list