From d42eeebb5a11ca405a3c84a5ab7e6d38d84c7750 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Sun, 14 Jul 2013 17:32:54 -0700 Subject: [PATCH] made a convenient msg_q_init2 the original msg_q_init takes a q handle in the parameter list which makes it inconvenient for chain statement. This really adds nothing be making it slightly convenient Change-Id: I1e7f931d6b278c804ec6f7d87c1a79a3ffcceb75 --- utils/msg_q.c | 14 ++++++++++++++ utils/msg_q.h | 20 +++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/utils/msg_q.c b/utils/msg_q.c index c4f3b9d9..f82d4c03 100644 --- a/utils/msg_q.c +++ b/utils/msg_q.c @@ -136,6 +136,20 @@ msq_q_err_type msg_q_init(void** msg_q_data) return eMSG_Q_SUCCESS; } +/*=========================================================================== + + FUNCTION: msg_q_init2 + + ===========================================================================*/ +const void* msg_q_init2() +{ + void* q = NULL; + if (eMSG_Q_SUCCESS != msg_q_init(&q)) { + q = NULL; + } + return q; +} + /*=========================================================================== FUNCTION: msg_q_destroy diff --git a/utils/msg_q.h b/utils/msg_q.h index d3d5cc5d..453b8ce3 100644 --- a/utils/msg_q.h +++ b/utils/msg_q.h @@ -58,7 +58,7 @@ FUNCTION msg_q_init DESCRIPTION Initializes internal structures for message queue. - msg_q_data: State of message queue to be initialized. + msg_q_data: pointer to an opaque Q handle to be returned; NULL if fails DEPENDENCIES N/A @@ -72,6 +72,24 @@ SIDE EFFECTS ===========================================================================*/ msq_q_err_type msg_q_init(void** msg_q_data); +/*=========================================================================== +FUNCTION msg_q_init2 + +DESCRIPTION + Initializes internal structures for message queue. + +DEPENDENCIES + N/A + +RETURN VALUE + opaque handle to the Q created; NULL if create fails + +SIDE EFFECTS + N/A + +===========================================================================*/ +const void* msg_q_init2(); + /*=========================================================================== FUNCTION msg_q_destroy