[asterisk-commits] russell: trunk r81260 - in /trunk: funcs/ include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 28 13:32:56 CDT 2007


Author: russell
Date: Tue Aug 28 13:32:56 2007
New Revision: 81260

URL: http://svn.digium.com/view/asterisk?view=rev&rev=81260
Log:
* Constify the uid field of channel datastores
* Convert some spaces to tabs in func_volume
* Add a note in channel.h making it clear that none of the datastore API calls
  lock the channel they are given, so the channel should be locked before
  calling the functions that take a channel argument.

Modified:
    trunk/funcs/func_volume.c
    trunk/include/asterisk/channel.h
    trunk/main/channel.c

Modified: trunk/funcs/func_volume.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_volume.c?view=diff&rev=81260&r1=81259&r2=81260
==============================================================================
--- trunk/funcs/func_volume.c (original)
+++ trunk/funcs/func_volume.c Tue Aug 28 13:32:56 2007
@@ -58,8 +58,8 @@
 
 /*! \brief Static structure for datastore information */
 static const struct ast_datastore_info volume_datastore = {
-        .type = "volume",
-        .destroy = destroy_callback
+	.type = "volume",
+	.destroy = destroy_callback
 };
 
 static int volume_callback(struct ast_audiohook *audiohook, struct ast_channel *chan, struct ast_frame *frame, enum ast_audiohook_direction direction)

Modified: trunk/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=81260&r1=81259&r2=81260
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Tue Aug 28 13:32:56 2007
@@ -195,7 +195,7 @@
 
 /*! \brief Structure for a channel data store */
 struct ast_datastore {
-	char *uid;		/*!< Unique data store identifier */
+	const char *uid;		/*!< Unique data store identifier */
 	void *data;		/*!< Contained data */
 	const struct ast_datastore_info *info;	/*!< Data store type information */
 	unsigned int inheritance;	/*!< Number of levels this item will continue to be inherited */
@@ -615,8 +615,14 @@
 	CHANNEL_MANAGER_RELOAD,
 };
 
-/*! \brief Create a channel datastore structure */
-struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, char *uid);
+/*! 
+ * \brief Create a channel datastore structure 
+ *
+ * \note None of the datastore API calls lock the ast_channel they are using.
+ *       So, the channel should be locked before calling the functions that
+ *       take a channel argument.
+ */
+struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid);
 
 /*! \brief Free a channel datastore structure */
 int ast_channel_datastore_free(struct ast_datastore *datastore);
@@ -631,7 +637,7 @@
 int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore);
 
 /*! \brief Find a datastore on a channel */
-struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, char *uid);
+struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid);
 
 /*! \brief Change the state of a channel */
 int ast_setstate(struct ast_channel *chan, enum ast_channel_state);

Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=81260&r1=81259&r2=81260
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Tue Aug 28 13:32:56 2007
@@ -1167,7 +1167,7 @@
 	ast_device_state_changed_literal(name);
 }
 
-struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, char *uid)
+struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
 {
 	struct ast_datastore *datastore = NULL;
 
@@ -1201,7 +1201,7 @@
 
 	/* Free allocated UID memory */
 	if (datastore->uid != NULL) {
-		ast_free(datastore->uid);
+		ast_free((void *) datastore->uid);
 		datastore->uid = NULL;
 	}
 
@@ -1255,7 +1255,7 @@
 	return res;
 }
 
-struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, char *uid)
+struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
 {
 	struct ast_datastore *datastore = NULL;
 	




More information about the asterisk-commits mailing list