[Asterisk-code-review] app queue: Cleanup queue ref / queue unref routines. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Tue Nov 20 05:05:33 CST 2018


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/10689 )

Change subject: app_queue: Cleanup queue_ref / queue_unref routines.
......................................................................

app_queue: Cleanup queue_ref / queue_unref routines.

This replaces the inline functions with macros.  This removes the need
to directly use __ao2_ref, opts instead for standard ao2_bump and
ao2_cleanup macros.

Change-Id: If4e04e9bab2e3c883188437cb9f487b3e498a21b
---
M apps/app_queue.c
1 file changed, 4 insertions(+), 18 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/apps/app_queue.c b/apps/app_queue.c
index 80c253f..e576094 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1918,27 +1918,13 @@
 	ao2_callback(queue->members, OBJ_NODATA | OBJ_MULTIPLE, queue_member_decrement_followers, &pos);
 }
 
-#define queue_ref(q)				_queue_ref(q, "", __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#define queue_unref(q)				_queue_unref(q, "", __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#define queue_t_ref(q, tag)			_queue_ref(q, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#define queue_t_unref(q, tag)		_queue_unref(q, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define queue_ref(q)				ao2_bump(q)
+#define queue_unref(q)				({ ao2_cleanup(q); NULL; })
+#define queue_t_ref(q, tag)			ao2_t_bump(q, tag)
+#define queue_t_unref(q, tag)		({ ao2_t_cleanup(q, tag); NULL; })
 #define queues_t_link(c, q, tag)	ao2_t_link(c, q, tag)
 #define queues_t_unlink(c, q, tag)	ao2_t_unlink(c, q, tag)
 
-static inline struct call_queue *_queue_ref(struct call_queue *q, const char *tag, const char *file, int line, const char *filename)
-{
-	__ao2_ref(q, 1, tag, file, line, filename);
-	return q;
-}
-
-static inline struct call_queue *_queue_unref(struct call_queue *q, const char *tag, const char *file, int line, const char *filename)
-{
-	if (q) {
-		__ao2_ref(q, -1, tag, file, line, filename);
-	}
-	return NULL;
-}
-
 /*! \brief Set variables of queue */
 static void set_queue_variables(struct call_queue *q, struct ast_channel *chan)
 {

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If4e04e9bab2e3c883188437cb9f487b3e498a21b
Gerrit-Change-Number: 10689
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2 (1000185)
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181120/80245940/attachment-0001.html>


More information about the asterisk-code-review mailing list