[asterisk-commits] russell: trunk r48103 - /trunk/main/utils.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Nov 28 22:08:19 MST 2006


Author: russell
Date: Tue Nov 28 23:08:19 2006
New Revision: 48103

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48103
Log:
Remove an XXX command suggesting that this truncation should not be conditional,
and also add a more verbose comment explaining why it is only needed in the
case of appending to the string for any curious readers that come along in the
future.

Modified:
    trunk/main/utils.c

Modified: trunk/main/utils.c
URL: http://svn.digium.com/view/asterisk/trunk/main/utils.c?view=diff&rev=48103&r1=48102&r2=48103
==============================================================================
--- trunk/main/utils.c (original)
+++ trunk/main/utils.c Tue Nov 28 23:08:19 2006
@@ -997,7 +997,14 @@
 			return AST_DYNSTR_BUILD_FAILED;
 		(*buf)->len = need;
 
-		/* Truncate the previous attempt. XXX this should be unconditional */
+		/* Truncate the previous attempt.  This is only needed for the
+		 * append operation because if the write is from the beginning,
+		 * it will get automatically overwritten when this function
+		 * gets called again.  When appending, if this was not done,
+		 * this function would be called over and over again, because
+		 * each attempt would be appending more and more partial
+		 * strings, never having enough space to finish.
+		 */ 
 		if (append)
 			(*buf)->str[offset] = '\0';
 



More information about the asterisk-commits mailing list