[asterisk-commits] russell: branch 1.6.1 r176906 - in /branches/1.6.1: ./ include/asterisk/heap.h

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 18 00:15:36 CST 2009


Author: russell
Date: Wed Feb 18 00:15:35 2009
New Revision: 176906

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=176906
Log:
Merged revisions 176904 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r176904 | russell | 2009-02-18 00:14:47 -0600 (Wed, 18 Feb 2009) | 2 lines

Add example code for a heap traversal.

........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/include/asterisk/heap.h

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/include/asterisk/heap.h
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.1/include/asterisk/heap.h?view=diff&rev=176906&r1=176905&r2=176906
==============================================================================
--- branches/1.6.1/include/asterisk/heap.h (original)
+++ branches/1.6.1/include/asterisk/heap.h Wed Feb 18 00:15:35 2009
@@ -155,6 +155,28 @@
  * \note If this function is being used in combination with ast_heap_size() for
  *       purposes of traversing the heap, the heap must be locked for the entire
  *       duration of the traversal.
+ *
+ * Example code for a traversal:
+ * \code
+ *
+ * struct ast_heap *h;
+ *
+ * ...
+ *
+ * size_t size, i;
+ * void *cur_obj;
+ *
+ * ast_heap_rdlock(h);
+ *
+ * size = ast_heap_size(h);
+ *
+ * for (i = 1; i <= size && (cur_obj = ast_heap_peek(h, i)); i++) {
+ *     ... Do stuff with cur_obj ...
+ * }
+ *
+ * ast_heap_unlock(h);
+ *
+ * \endcode
  */
 void *ast_heap_peek(struct ast_heap *h, unsigned int index);
 




More information about the asterisk-commits mailing list