[asterisk-commits] akshayb: branch akshayb/ao2_containers r274867 - /team/akshayb/ao2_containers...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 9 06:07:54 CDT 2010


Author: akshayb
Date: Fri Jul  9 06:07:51 2010
New Revision: 274867

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=274867
Log:
For transfering to nebook

Modified:
    team/akshayb/ao2_containers/main/astobj2_btree.c
    team/akshayb/ao2_containers/main/btree.c

Modified: team/akshayb/ao2_containers/main/astobj2_btree.c
URL: http://svnview.digium.com/svn/asterisk/team/akshayb/ao2_containers/main/astobj2_btree.c?view=diff&rev=274867&r1=274866&r2=274867
==============================================================================
--- team/akshayb/ao2_containers/main/astobj2_btree.c (original)
+++ team/akshayb/ao2_containers/main/astobj2_btree.c Fri Jul  9 06:07:51 2010
@@ -296,11 +296,12 @@
 	/* optimization. If the container is unchanged and
 	 * we have a pointer, try follow it
 	 */
-	if (a->c->version == a->c_version && (p = a->obj)) {
-		if ((p = AST_LIST_NEXT(p,entry)))
+	if (a->c->ao2_container_core.version == a->c_version && (p = a->obj)) {
+		//if ((p = AST_LIST_NEXT(p,entry)))
+		
 			goto found;
 		/* nope, start from the next bucket */
-		a->bucket++;
+		a->node_key++;
 		a->version = 0;
 		a->obj = NULL;
 	}
@@ -309,10 +310,10 @@
 	/* Browse the buckets array, moving to the next
 	 * buckets if we don't find the entry in the current one.
 	 * Stop when we find an element with version number greater
-	 * than the current one (we reset the version to 0 when we
+	 * than the current one (we reset the version to 0 
 	 * switch buckets).
 	 */
 
 	for (; a->bucket < lim; a->bucket++, a->version = 0) {
 		/* scan the current bucket */
-		AST_
+		AST_BTREE_TRAVERSE(_

Modified: team/akshayb/ao2_containers/main/btree.c
URL: http://svnview.digium.com/svn/asterisk/team/akshayb/ao2_containers/main/btree.c?view=diff&rev=274867&r1=274866&r2=274867
==============================================================================
--- team/akshayb/ao2_containers/main/btree.c (original)
+++ team/akshayb/ao2_containers/main/btree.c Fri Jul  9 06:07:51 2010
@@ -851,6 +851,54 @@
 	}
 	print("\n");
 }
-
+/* Return equivalent to print single node */
+static void print_single_node(btree *btree, bt_node * node) {
+	
+	int i = 0;
+	
+	print(" { ");	
+	while(i < node->nr_active) {
+		print("0x%x(%d) ", btree->value(node->key_vals[i]->key),
+			node->level);
+		i++;
+	}
+	print("} (0x%x,%d) ", node,node->leaf);	
+}
+
+/*This function is for traversing through the tree */
+void traverse_subtree(struct btree *btree,struct bt_node * node) {
+	
+	int i = 0;
+	unsigned int current_level;
+
+	struct bt_node * head, * tail;
+	struct bt_node * child;
+
+	current_level = node->level;
+	head = node;
+	tail = node;
+
+	while(true) {
+		if(head == NULL) {
+			break;
+		}
+		if (head->level < current_level) {
+			current_level = head->level;
+			print("\n");
+		}
+		print_single_node(btree,head);
+
+		if(head->leaf == false) {	
+			for(i = 0 ; i < head->nr_active + 1; i++) {
+				child = head->children[i];
+				tail->next = child;
+				tail = child;
+				child->next = NULL;
+			}
+		}
+		head = head->next;	
+	}
+	print("\n");
+}
 
 #endif




More information about the asterisk-commits mailing list