[Asterisk-code-review] cdr.c: Use current ao2 flag names (asterisk[14])

Richard Mudgett asteriskteam at digium.com
Mon Oct 9 13:27:36 CDT 2017


Richard Mudgett has uploaded this change for review. ( https://gerrit.asterisk.org/6699


Change subject: cdr.c: Use current ao2 flag names
......................................................................

cdr.c: Use current ao2 flag names

Change-Id: Ib59d7d2f2a4a822754628f2c48a308d6791a6e6e
---
M main/cdr.c
1 file changed, 18 insertions(+), 18 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/99/6699/1

diff --git a/main/cdr.c b/main/cdr.c
index 4bcfc05..fe54029 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -788,11 +788,11 @@
 	const struct cdr_object *cdr;
 	const char *key;
 
-	switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
-	case OBJ_KEY:
+	switch (flags & OBJ_SEARCH_MASK) {
+	case OBJ_SEARCH_KEY:
 		key = obj;
 		break;
-	case OBJ_POINTER:
+	case OBJ_SEARCH_OBJECT:
 		cdr = obj;
 		key = cdr->uniqueid;
 		break;
@@ -813,14 +813,14 @@
     const char *right_key = arg;
     int cmp;
 
-    switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
-    case OBJ_POINTER:
+    switch (flags & OBJ_SEARCH_MASK) {
+    case OBJ_SEARCH_OBJECT:
         right_key = right->uniqueid;
         /* Fall through */
-    case OBJ_KEY:
+    case OBJ_SEARCH_KEY:
         cmp = strcmp(left->uniqueid, right_key);
         break;
-    case OBJ_PARTIAL_KEY:
+    case OBJ_SEARCH_PARTIAL_KEY:
         /*
          * We could also use a partial key struct containing a length
          * so strlen() does not get called for every comparison instead.
@@ -1575,7 +1575,7 @@
 		!success && (channel_id = ao2_iterator_next(&it_cdrs));
 		ao2_ref(channel_id, -1)) {
 		RAII_VAR(struct cdr_object *, cand_cdr_master,
-			ao2_find(active_cdrs_by_channel, channel_id, OBJ_KEY),
+			ao2_find(active_cdrs_by_channel, channel_id, OBJ_SEARCH_KEY),
 			ao2_cleanup);
 		struct cdr_object *cand_cdr;
 
@@ -1725,7 +1725,7 @@
 		!success && (channel_id = ao2_iterator_next(&it_cdrs));
 		ao2_ref(channel_id, -1)) {
 		RAII_VAR(struct cdr_object *, cand_cdr_master,
-			ao2_find(active_cdrs_by_channel, channel_id, OBJ_KEY),
+			ao2_find(active_cdrs_by_channel, channel_id, OBJ_SEARCH_KEY),
 			ao2_cleanup);
 		struct cdr_object *cand_cdr;
 
@@ -1966,9 +1966,9 @@
 
 	/* Figure out who is running this show */
 	if (caller) {
-		cdr = ao2_find(active_cdrs_by_channel, caller->uniqueid, OBJ_KEY);
+		cdr = ao2_find(active_cdrs_by_channel, caller->uniqueid, OBJ_SEARCH_KEY);
 	} else {
-		cdr = ao2_find(active_cdrs_by_channel, peer->uniqueid, OBJ_KEY);
+		cdr = ao2_find(active_cdrs_by_channel, peer->uniqueid, OBJ_SEARCH_KEY);
 	}
 
 	if (!cdr) {
@@ -2122,7 +2122,7 @@
 
 	/* Handle Party A */
 	if (!cdr) {
-		cdr = ao2_find(active_cdrs_by_channel, uniqueid, OBJ_KEY);
+		cdr = ao2_find(active_cdrs_by_channel, uniqueid, OBJ_SEARCH_KEY);
 	}
 	if (!cdr) {
 		ast_log(AST_LOG_WARNING, "No CDR for channel %s\n", name);
@@ -2228,7 +2228,7 @@
 	RAII_VAR(struct module_config *, mod_cfg,
 			ao2_global_obj_ref(module_configs), ao2_cleanup);
 	RAII_VAR(struct cdr_object *, cdr,
-			ao2_find(active_cdrs_by_channel, channel->uniqueid, OBJ_KEY),
+			ao2_find(active_cdrs_by_channel, channel->uniqueid, OBJ_SEARCH_KEY),
 			ao2_cleanup);
 	struct cdr_object *it_cdr;
 	struct bridge_leave_data leave_data = {
@@ -2385,7 +2385,7 @@
 	it_channels = ao2_iterator_init(bridge->channels, 0);
 	while ((channel_id = ao2_iterator_next(&it_channels))) {
 		RAII_VAR(struct cdr_object *, cand_cdr,
-			ao2_find(active_cdrs_by_channel, channel_id, OBJ_KEY),
+			ao2_find(active_cdrs_by_channel, channel_id, OBJ_SEARCH_KEY),
 			ao2_cleanup);
 
 		if (!cand_cdr) {
@@ -2531,7 +2531,7 @@
 	struct ast_bridge_snapshot *bridge = update->bridge;
 	struct ast_channel_snapshot *channel = update->channel;
 	RAII_VAR(struct cdr_object *, cdr,
-			ao2_find(active_cdrs_by_channel, channel->uniqueid, OBJ_KEY),
+			ao2_find(active_cdrs_by_channel, channel->uniqueid, OBJ_SEARCH_KEY),
 			ao2_cleanup);
 	RAII_VAR(struct module_config *, mod_cfg,
 			ao2_global_obj_ref(module_configs), ao2_cleanup);
@@ -2599,7 +2599,7 @@
 			(unsigned int)stasis_message_timestamp(message)->tv_sec,
 			(unsigned int)stasis_message_timestamp(message)->tv_usec);
 
-	cdr = ao2_find(active_cdrs_by_channel, channel->uniqueid, OBJ_KEY);
+	cdr = ao2_find(active_cdrs_by_channel, channel->uniqueid, OBJ_SEARCH_KEY);
 	if (!cdr) {
 		ast_log(AST_LOG_WARNING, "No CDR for channel %s\n", channel->name);
 		ast_assert(0);
@@ -4249,8 +4249,8 @@
 	stasis_message_router_add(stasis_router, ast_parked_call_type(), handle_parked_call_message, NULL);
 	stasis_message_router_add(stasis_router, cdr_sync_message_type(), handle_cdr_sync_message, NULL);
 
-	active_cdrs_by_channel = ao2_container_alloc(NUM_CDR_BUCKETS,
-		cdr_object_channel_hash_fn, cdr_object_channel_cmp_fn);
+	active_cdrs_by_channel = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,
+		NUM_CDR_BUCKETS, cdr_object_channel_hash_fn, NULL, cdr_object_channel_cmp_fn);
 	if (!active_cdrs_by_channel) {
 		return -1;
 	}

-- 
To view, visit https://gerrit.asterisk.org/6699
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib59d7d2f2a4a822754628f2c48a308d6791a6e6e
Gerrit-Change-Number: 6699
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171009/f312d46f/attachment-0001.html>


More information about the asterisk-code-review mailing list