[svn-commits] file: trunk r66399 - in /trunk: ./ doc/datastores.txt

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue May 29 08:44:52 MST 2007


Author: file
Date: Tue May 29 10:44:51 2007
New Revision: 66399

URL: http://svn.digium.com/view/asterisk?view=rev&rev=66399
Log:
Merged revisions 66398 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r66398 | file | 2007-05-29 11:43:16 -0400 (Tue, 29 May 2007) | 2 lines

Update datastores documentation. (issue #9801 reported by mnicholson)

........

Modified:
    trunk/   (props changed)
    trunk/doc/datastores.txt

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/doc/datastores.txt
URL: http://svn.digium.com/view/asterisk/trunk/doc/datastores.txt?view=diff&rev=66399&r1=66398&r2=66399
==============================================================================
--- trunk/doc/datastores.txt (original)
+++ trunk/doc/datastores.txt Tue May 29 10:44:51 2007
@@ -22,9 +22,8 @@
 1. Use ast_channel_datastore_alloc function to return a pre-allocated structure
    Ex: datastore = ast_channel_datastore_alloc(&example_datastore, "uid");
    This function takes two arguments: (datastore info structure, uid)
-2. Attach data and destroy callback to pre-allocated structure.
+2. Attach data to pre-allocated structure.
    Ex: datastore->data = mysillydata;
-       datastore->destroy = callback_destroy;
 3. Add datastore to the channel
    Ex: ast_channel_datastore_add(chan, datastore);
    This function takes two arguments: (pointer to channel, pointer to data store)
@@ -33,13 +32,12 @@
 
 void callback_destroy(void *data)
 {
-	free(data);
+	ast_free(data);
 }
 
 struct ast_datastore *datastore = NULL;
 datastore = ast_channel_datastore_alloc(&example_datastore, NULL);
 datastore->data = mysillydata;
-datastore->destroy = callback_destroy;
 ast_channel_datastore_add(chan, datastore);
 
 NOTE: Because you're passing a pointer to a function in your module, you'll want to include
@@ -53,11 +51,8 @@
 2. Remove the data store from the channel
    Ex: ast_channel_datastore_remove(chan, datastore);
    This function takes two arguments: (pointer to channel, pointer to data store)
-3. If we want to now, free the memory or do stuff to the data on the data store
-   If we do then we will want to unset the data and callback
-   Ex: datastore->data = NULL;
-       datastore->destroy = NULL;
-4. Free the data store
+3. If we want to now do stuff to the data on the data store
+4. Free the data store (this will call the destroy call back)
    Ex: ast_channel_datastore_free(datastore);
    This function takes one argument: (pointer to data store)
 



More information about the svn-commits mailing list