[asterisk-commits] russell: branch russell/heap r176214 - /team/russell/heap/include/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 16 15:00:46 CST 2009


Author: russell
Date: Mon Feb 16 15:00:46 2009
New Revision: 176214

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=176214
Log:
Document example usage of ast_heap_create including offsetof()

Modified:
    team/russell/heap/include/asterisk/heap.h

Modified: team/russell/heap/include/asterisk/heap.h
URL: http://svn.digium.com/svn-view/asterisk/team/russell/heap/include/asterisk/heap.h?view=diff&rev=176214&r1=176213&r2=176214
==============================================================================
--- team/russell/heap/include/asterisk/heap.h (original)
+++ team/russell/heap/include/asterisk/heap.h Mon Feb 16 15:00:46 2009
@@ -68,6 +68,30 @@
  *        then a negative value can be provided to indicate that no field for an
  *        offset has been allocated.
  *
+ * Example Usage:
+ *
+ * \code
+ *
+ * struct myobj {
+ *    int foo;
+ *    int bar;
+ *    char stuff[8];
+ *    char things[8];
+ *    ssize_t __heap_index;
+ * };
+ *
+ * ...
+ *
+ * static int myobj_cmp(void *obj1, void *obj2);
+ *
+ * ...
+ *
+ * struct ast_heap *h;
+ *
+ * h = ast_heap_create(8, myobj_cmp, offsetof(struct myobj, __heap_index));
+ *
+ * \endcode
+ *
  * \return An instance of a max heap
  */
 struct ast_heap *ast_heap_create(unsigned int init_height, ast_heap_cmp_fn cmp_fn,




More information about the asterisk-commits mailing list