[asterisk-commits] rizzo: branch rizzo/astobj2 r48500 - in /team/rizzo/astobj2: channels/ includ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Dec 15 09:28:05 MST 2006


Author: rizzo
Date: Fri Dec 15 10:28:04 2006
New Revision: 48500

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48500
Log:
more updates to trunk


Modified:
    team/rizzo/astobj2/channels/chan_features.c
    team/rizzo/astobj2/channels/chan_zap.c
    team/rizzo/astobj2/include/asterisk/channel.h
    team/rizzo/astobj2/include/asterisk/threadstorage.h
    team/rizzo/astobj2/main/channel.c

Modified: team/rizzo/astobj2/channels/chan_features.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_features.c?view=diff&rev=48500&r1=48499&r2=48500
==============================================================================
--- team/rizzo/astobj2/channels/chan_features.c (original)
+++ team/rizzo/astobj2/channels/chan_features.c Fri Dec 15 10:28:04 2006
@@ -462,7 +462,7 @@
 	for (x=1;x<4;x++) {
 		if (b2)
 			free(b2);
-		b2 = ast_safe_string_alloc("Feature/%s/%s-%d", p->tech, p->dest, x);
+		asprintf(&b2, "Feature/%s/%s-%d", p->tech, p->dest, x);
 		for (y=0;y<3;y++) {
 			if (y == index)
 				continue;

Modified: team/rizzo/astobj2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_zap.c?view=diff&rev=48500&r1=48499&r2=48500
==============================================================================
--- team/rizzo/astobj2/channels/chan_zap.c (original)
+++ team/rizzo/astobj2/channels/chan_zap.c Fri Dec 15 10:28:04 2006
@@ -5547,13 +5547,13 @@
 			free(b2);
 #ifdef HAVE_PRI
 		if (i->bearer || (i->pri && (i->sig == SIG_FXSKS)))
-			b2 = ast_safe_string_alloc("Zap/%d:%d-%d", i->pri->trunkgroup, i->channel, y);
+			asprintf(&b2, "Zap/%d:%d-%d", i->pri->trunkgroup, i->channel, y);
 		else
 #endif
 		if (i->channel == CHAN_PSEUDO)
-			b2 = ast_safe_string_alloc("Zap/pseudo-%d", ast_random());
+			asprintf(&b2, "Zap/pseudo-%ld", ast_random());
 		else	
-			b2 = ast_safe_string_alloc("Zap/%d-%d", i->channel, y);
+			asprintf(&b2, "Zap/%d-%d", i->channel, y);
 		for (x = 0; x < 3; x++) {
 			if ((index != x) && i->subs[x].owner && !strcasecmp(b2, i->subs[x].owner->name))
 				break;

Modified: team/rizzo/astobj2/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/include/asterisk/channel.h?view=diff&rev=48500&r1=48499&r2=48500
==============================================================================
--- team/rizzo/astobj2/include/asterisk/channel.h (original)
+++ team/rizzo/astobj2/include/asterisk/channel.h Fri Dec 15 10:28:04 2006
@@ -1143,12 +1143,6 @@
 
 void ast_set_callerid(struct ast_channel *chan, const char *cidnum, const char *cidname, const char *ani);
 
-
-/*! return a mallocd string with the result of sprintf of the fmt and following args */
-char *ast_safe_string_alloc(const char *fmt, ...);
-
-
-
 /*! Start a tone going */
 int ast_tonepair_start(struct ast_channel *chan, int freq1, int freq2, int duration, int vol);
 /*! Stop a tone from playing */

Modified: team/rizzo/astobj2/include/asterisk/threadstorage.h
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/include/asterisk/threadstorage.h?view=diff&rev=48500&r1=48499&r2=48500
==============================================================================
--- team/rizzo/astobj2/include/asterisk/threadstorage.h (original)
+++ team/rizzo/astobj2/include/asterisk/threadstorage.h Fri Dec 15 10:28:04 2006
@@ -162,13 +162,15 @@
 void __ast_threadstorage_cleanup(void *);
 
 /*!
- * \brief A dynamic length string
+ * A dynamic length string. This is just a C string prefixed by a length
+ * field. len reflects the actual space allocated, while the string is
+ * NUL-terminated as a regular C string.
+ * One should never declare a variable with this type, but only a pointer
+ * to it, and use ast_dynamic_str_create() to initialize it.
  */
 struct ast_dynamic_str {
-	/* The current maximum length of the string */
-	size_t len;
-	/* The string buffer */
-	char str[0];
+	size_t len;	/*!< The current maximum length of the string */
+	char str[0];	/*!< The string buffer */
 };
 
 /*!
@@ -179,7 +181,7 @@
  * \return This function returns a pointer to the dynamic string length.  The
  *         result will be NULL in the case of a memory allocation error.
  *
- * /note The result of this function is dynamically allocated memory, and must
+ * \note The result of this function is dynamically allocated memory, and must
  *       be free()'d after it is no longer needed.
  */
 AST_INLINE_API(

Modified: team/rizzo/astobj2/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/main/channel.c?view=diff&rev=48500&r1=48499&r2=48500
==============================================================================
--- team/rizzo/astobj2/main/channel.c (original)
+++ team/rizzo/astobj2/main/channel.c Fri Dec 15 10:28:04 2006
@@ -329,21 +329,6 @@
 	res = ast_check_hangup(chan);
 	ast_channel_unlock(chan);
 	return res;
-}
-
-/*! \brief printf the string into a correctly sized mallocd buffer, and return the buffer */
-char *ast_safe_string_alloc(const char *fmt, ...)
-{
-	char *b2,buf[1];
-	int len;
-
-	va_list args;
-	va_start(args, fmt);
-	len = vsnprintf(buf, 1, fmt, args);
-	b2 = ast_malloc(len+1);
-	vsnprintf(b2, len+1,  fmt, args);
-	va_end(args);
-	return b2;
 }
 
 /*! \brief Initiate system shutdown */



More information about the asterisk-commits mailing list