[asterisk-commits] mmichelson: branch mmichelson/ao2_containers r165038 - in /team/mmichelson/ao...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 16 18:22:02 CST 2008
Author: mmichelson
Date: Tue Dec 16 18:22:02 2008
New Revision: 165038
URL: http://svn.digium.com/view/asterisk?view=rev&rev=165038
Log:
More documentation updates
Modified:
team/mmichelson/ao2_containers/include/asterisk/astobj2_private.h
team/mmichelson/ao2_containers/main/astobj2_hashtable.c
Modified: team/mmichelson/ao2_containers/include/asterisk/astobj2_private.h
URL: http://svn.digium.com/view/asterisk/team/mmichelson/ao2_containers/include/asterisk/astobj2_private.h?view=diff&rev=165038&r1=165037&r2=165038
==============================================================================
--- team/mmichelson/ao2_containers/include/asterisk/astobj2_private.h (original)
+++ team/mmichelson/ao2_containers/include/asterisk/astobj2_private.h Tue Dec 16 18:22:02 2008
@@ -6,12 +6,11 @@
#include "asterisk/lock.h"
/*!
- * A container; stores the hash and callback functions, information on
- * the size, the hash bucket heads, and a version number, starting at 0
- * (for a newly created, empty container)
- * and incremented every time an object is inserted or deleted.
- * The assumption is that an object is never moved in a container,
- * but removed and readded with the new number.
+ * A container; comparison function, information on the size,
+ * and a version number, starting at 0 (for a newly created,
+ * empty container) and incremented every time an object is inserted
+ * or deleted. The assumption is that an object is never moved
+ * in a container, but removed and readded with the new number.
* The version number is especially useful when implementing iterators.
* In fact, we can associate a unique, monotonically increasing number to
* each object, which means that, within an iterator, we can store the
@@ -20,13 +19,7 @@
* Since all objects have a version >0, we can use 0 as a marker for
* 'we need the first object in the bucket'.
*
- * \todo Linking and unlink objects is typically expensive, as it
- * involves a malloc() of a small object which is very inefficient.
- * To optimize this, we allocate larger arrays of bucket_list's
- * when we run out of them, and then manage our own freelist.
- * This will be more efficient as we can do the freelist management while
- * we hold the lock (that we need anyways).
- */
+ */
struct ao2_container {
const struct ao2_container_impl *impl;
ao2_callback_fn *cmp_fn;
@@ -35,7 +28,7 @@
/*! described above */
int version;
/*! container data specific to each implementation */
- void *private;
+ void *priv;
};
/*!
Modified: team/mmichelson/ao2_containers/main/astobj2_hashtable.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/ao2_containers/main/astobj2_hashtable.c?view=diff&rev=165038&r1=165037&r2=165038
==============================================================================
--- team/mmichelson/ao2_containers/main/astobj2_hashtable.c (original)
+++ team/mmichelson/ao2_containers/main/astobj2_hashtable.c Tue Dec 16 18:22:02 2008
@@ -57,7 +57,8 @@
*
* it is convenient to have a hash function that always returns 0.
* This is basically used when we want to have a container that is
- * a simple linked list.
+ * a simple linked list. It is preferable to use the ao2_linkedlist
+ * implementation instead though.
*
* \returns 0
*/
@@ -89,6 +90,13 @@
return hashtable;
}
+/* \todo Linking and unlink objects is typically expensive, as it
+ * involves a malloc() of a small object which is very inefficient.
+ * To optimize this, we allocate larger arrays of bucket_list's
+ * when we run out of them, and then manage our own freelist.
+ * This will be more efficient as we can do the freelist management while
+ * we hold the lock (that we need anyways).
+ */
static void *hashtable_link(struct ao2_container *c, struct astobj2 *newobj)
{
struct bucket_list *bl;
More information about the asterisk-commits
mailing list