[asterisk-commits] tilghman: trunk r168090 - in /trunk: include/asterisk/strings.h res/res_agi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jan 9 12:30:55 CST 2009
Author: tilghman
Date: Fri Jan 9 12:30:55 2009
New Revision: 168090
URL: http://svn.digium.com/view/asterisk?view=rev&rev=168090
Log:
When using ast_str with a non-ast_str-enabled API, we need to update the buffer
or otherwise, we cannot use ast_str_strlen().
Modified:
trunk/include/asterisk/strings.h
trunk/res/res_agi.c
Modified: trunk/include/asterisk/strings.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/strings.h?view=diff&rev=168090&r1=168089&r2=168090
==============================================================================
--- trunk/include/asterisk/strings.h (original)
+++ trunk/include/asterisk/strings.h Fri Jan 9 12:30:55 2009
@@ -403,6 +403,16 @@
}
)
+/*! \brief Update the length of the buffer, after using ast_str merely as a buffer.
+ * \param buf A pointer to the ast_str string.
+ */
+AST_INLINE_API(
+void ast_str_update(struct ast_str *buf),
+{
+ buf->__AST_STR_USED = strlen(buf->__AST_STR_STR);
+}
+)
+
/*! \brief Trims trailing whitespace characters from an ast_str string.
* \param buf A pointer to the ast_str string.
*/
Modified: trunk/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_agi.c?view=diff&rev=168090&r1=168089&r2=168090
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Fri Jan 9 12:30:55 2009
@@ -1861,6 +1861,7 @@
do {
res = ast_db_get(argv[2], argv[3], ast_str_buffer(buf), ast_str_size(buf));
+ ast_str_update(buf);
if (ast_str_strlen(buf) < ast_str_size(buf) - 1) {
break;
}
More information about the asterisk-commits
mailing list