Remove an XXX command suggesting that this truncation should not be conditional,
authorRussell Bryant <russell@russellbryant.com>
Wed, 29 Nov 2006 05:08:19 +0000 (05:08 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 29 Nov 2006 05:08:19 +0000 (05:08 +0000)
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.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48103 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/utils.c

index 5d18554..555800b 100644 (file)
@@ -997,7 +997,14 @@ int ast_dynamic_str_thread_build_va(struct ast_dynamic_str **buf, size_t max_len
                        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';