osaf/services/saf/amf/amfd/include/cb.h | 32 +++-----------------------------
osaf/services/saf/amf/amfd/ndmsg.cc | 10 ++++------
2 files changed, 7 insertions(+), 35 deletions(-)
Use std::queue instead of macro m_AVD_DTOND_MSG_PUSH and POP
diff --git a/osaf/services/saf/amf/amfd/include/cb.h
b/osaf/services/saf/amf/amfd/include/cb.h
--- a/osaf/services/saf/amf/amfd/include/cb.h
+++ b/osaf/services/saf/amf/amfd/include/cb.h
@@ -45,6 +45,8 @@
#include <timer.h>
#include <list>
+#include <queue>
+
class AVD_SI;
class AVD_AVND;
@@ -74,11 +76,6 @@ typedef struct avsv_nd_msg_queue {
struct avsv_nd_msg_queue *next;
} AVSV_ND_MSG_QUEUE;
-typedef struct avsv_nd_msg_list {
- AVSV_ND_MSG_QUEUE *nd_msg_queue;
- AVSV_ND_MSG_QUEUE *tail;
-} AVSV_ND_MSG_LIST;
-
/* For external components, we need to have a list of health check information
as the health check is assotiated with node. But we wouldn't have health
check assoiated with any cluster node, so we have to have this information
@@ -158,7 +155,7 @@ typedef struct cl_cb_tag {
* Message queue to hold messages to be sent to the ND.
* This is a FIFO queue.
*/
- AVSV_ND_MSG_LIST nd_msg_queue_list;
+ std::queue<AVSV_ND_MSG_QUEUE*> nd_msg_queue_list {};
/* Event Queue to hold the events during fail-over */
AVD_EVT_QUEUE_LIST evt_queue;
@@ -239,29 +236,6 @@ typedef struct cl_cb_tag {
} AVD_CL_CB;
-/* macro to push the ND msg in the queue (to the end of the list) */
-#define m_AVD_DTOND_MSG_PUSH(cb, msg) \
-{ \
- AVSV_ND_MSG_LIST *list = &((cb)->nd_msg_queue_list); \
- if (!(list->nd_msg_queue)) \
- list->nd_msg_queue = (msg); \
- else \
- list->tail->next = (msg); \
- list->tail = (msg); \
-}
-
-/* macro to pop the msg (from the beginning of the list) */
-#define m_AVD_DTOND_MSG_POP(cb, msg) \
-{ \
- AVSV_ND_MSG_LIST *list = &((cb)->nd_msg_queue_list); \
- if (list->nd_msg_queue) { \
- (msg) = list->nd_msg_queue; \
- list->nd_msg_queue = (msg)->next; \
- (msg)->next = 0; \
- if (list->tail == (msg)) list->tail = 0; \
- } else (msg) = 0; \
-}
-
/* macro to enqueue the AVD events in the queue (to the end of the list) */
#define m_AVD_EVT_QUEUE_ENQUEUE(cb, evt) \
{ \
diff --git a/osaf/services/saf/amf/amfd/ndmsg.cc
b/osaf/services/saf/amf/amfd/ndmsg.cc
--- a/osaf/services/saf/amf/amfd/ndmsg.cc
+++ b/osaf/services/saf/amf/amfd/ndmsg.cc
@@ -203,7 +203,7 @@ static void avd_d2n_msg_enqueue(AVD_CL_C
memcpy(&nd_msg->snd_msg, snd_mds, sizeof(NCSMDS_INFO));
- m_AVD_DTOND_MSG_PUSH(cb, nd_msg);
+ cb->nd_msg_queue_list.push(nd_msg);
}
/****************************************************************************
@@ -226,9 +226,9 @@ uint32_t avd_d2n_msg_dequeue(AVD_CL_CB *
* De-queue messages from the Queue and then do the MDS send.
*/
- m_AVD_DTOND_MSG_POP(cb, queue_elem);
-
- while (queue_elem != NULL) {
+ while (!cb->nd_msg_queue_list.empty()) {
+ queue_elem = cb->nd_msg_queue_list.front();
+ cb->nd_msg_queue_list.pop();
/*
* Now do MDS send.
*/
@@ -239,8 +239,6 @@ uint32_t avd_d2n_msg_dequeue(AVD_CL_CB *
d2n_msg_free((AVD_DND_MSG
*)queue_elem->snd_msg.info.svc_send.i_msg);
delete queue_elem;
-
- m_AVD_DTOND_MSG_POP(cb, queue_elem);
}
return rc;
------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel